Skip to content

Haml on JRuby 9.2.0.0 throws error evaluating interpolated element attribute with # #5210

@HarlemSquirrel

Description

@HarlemSquirrel

Interesting issue with JRuby 9.2.0.0 and Haml when attempting to evaluate an element attribute with a # just before the interpolated variable.

This is the line which causes the error.

-# app/views/welcome/_partial.html.haml
%p{ data: { target: "##{partial_local_var}" } }
Error:
WelcomesTest#test_visiting_the_index:
ActionView::Template::Error: undefined local variable or method `partial_local_var' for #<Haml::AttributeCompiler:0x9906d99>
    (eval):1:in `<eval>'
    app/views/welcome/index.html.erb:3:in `_app_views_welcome_index_html_erb___706324677_2068'

Using %p{ data: { target: ('#' + partial_local_var.to_s) } } does not throw the error.

I made a test app to demonstrate the error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions