Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

There was a problem

You must be a member of this account.

This project is archived and is in readonly mode.

Erubis template parsing error on invalid match for variable name containing "do"

#4575

Re: Rails 3.0.0.beta3

See add_expr_literal method in Template::Handlers::Erubis. The expression BLOCK_EXPR falsely matches "do" during template compilation for a variable named "todo."

To reproduce, generate a scaffold for an entity named "Todo." The default output for the "Show" link is malformed and generates a syntax error ("unexpected tIVAR, expecting keyword_do or '{' or '('").

BLOCK_EXPR probably just needs word boundaries or whitespace around the "do."

If necessary, this mailing list thread has additional info:

http://groups.google.com/group/rubyonrails-talk/browse_thread/threa...

Reported by Mike · May 11th, 2010 @ 01:23 PM

State: resolved
Milestone: 3.0.2
Assigned to: José Valim José Valim
Importance: High

Activity

  1. Ryan Bigg
    Ryan Bigg
    • Tag changed from 3.0.0.beta3, erubis to 3.0.0.beta3, bugmash, erubis
    • State changed from new to incomplete

    Please provide a failing test case and patch for this issue.

    May 13th, 2010 @ 11:45 PM

  2. Jeff Kreeftmeijer
    Jeff Kreeftmeijer

    Verified on master. When I generate a scaffold called todo, start the server and go to /todos, it throws a SyntaxError:

    compile error
    /Users/jeff/rails/tada/app/views/todos/index.html.erb:16: syntax error, unexpected tIVAR, expecting kDO or '{' or '('
    ...to 'Show', todo @output_buffer.safe_concat('</td>
                                  ^
    

    Here's the Framework Trace.

    May 15th, 2010 @ 11:37 PM

  3. Simon Jefford
    Simon Jefford

    I've attached a patch

    It doesn't have any tests at the moment - hoping to enlist some help on that front...

    May 16th, 2010 @ 01:31 AM

  4. Simon Jefford
  5. Santiago Pastorino
    Santiago Pastorino
    • Milestone cleared.
    • Tag changed from 3.0.0.beta3, bugmash, erubis to 3.0.0.beta3, bugmash, bugmash-review, erubis, patch
    • State changed from incomplete to open
    • Assigned user set to José Valim

    Well done Simon +1

    May 16th, 2010 @ 06:33 AM

  6. Eric Hutzelman
    Eric Hutzelman

    +1 applies cleanly to master, tests pass. Scaffold generated Todo views no longer throw errors on 'show' links.

    May 16th, 2010 @ 07:17 AM

  7. Repository
  8. Rizwan Reza
    Rizwan Reza
    • Tag changed from 3.0.0.beta3, bugmash, bugmash-review, erubis, patch to 3.0.0.beta3, bugmash, erubis, patch

    May 16th, 2010 @ 03:06 PM

  9. Rizwan Reza
    Rizwan Reza
    • Tag changed from 3.0.0.beta3, bugmash, erubis, patch to 3.0.0.beta3, bugmash-review, erubis, patch
    • State changed from resolved to verified

    May 16th, 2010 @ 04:49 PM

  10. Rizwan Reza
    Rizwan Reza
    • State changed from verified to resolved

    May 16th, 2010 @ 04:51 PM

  11. Rizwan Reza
    Rizwan Reza
    • Tag changed from 3.0.0.beta3, bugmash-review, erubis, patch to 3.0.0.beta3, erubis, patch

    May 16th, 2010 @ 04:51 PM

  12. Jeremy Kemper
    Jeremy Kemper
    • Milestone set to 3.0.2
    • Importance changed from to High

    October 15th, 2010 @ 11:01 PM

  13. bingbing