[Rails] link_to error in beta3

7 views
Skip to first unread message

Mike

unread,
May 10, 2010, 12:24:48 PM5/10/10
to Ruby on Rails: Talk
Can anybody take a quick look at the following problem, occurring with
beta3 on Ruby 1.9.2 ?

http://gist.github.com/396208

I used the scaffold generator for the above, so this is just using
defaults (the example is in an index view; specifying an action works
but the shorter version doesn't).

Also, 'entity' does have a primary key.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Mike

unread,
May 10, 2010, 7:23:05 PM5/10/10
to Ruby on Rails: Talk
This is weird.

Check this out:

http://gist.github.com/396575

See how "link_to 'Show'" is output (Line 39)? Especially compared to
the other link_to calls?

I changed my view template to the following and it works:

http://gist.github.com/396679

In other words, I just threw a semi-colon in there and it works. I
don't know exactly where this should be fixed . . .

Mike

unread,
May 10, 2010, 9:05:52 PM5/10/10
to Ruby on Rails: Talk
I updated the gist with additional information:

http://gist.github.com/396679

I'm still drilling down into this but the problem is happening inside
the erubis gem when the template is parsed.

When the variable name is 'todx' the output includes:

@output_buffer.safe_concat('</td>\n <td>');
@output_buffer.append= ( link_to 'Show', todx );
@output_buffer.safe_concat('</td>\n <td>');

But when the variable name is 'todo' the output is:

@output_buffer.safe_concat('</td>\n <td>');
@output_buffer.append= link_to 'Show', todo
@output_buffer.safe_concat('</td>\n <td>');

It's mangled; I wonder if it's matching "do" somewhere?

Mike

unread,
May 10, 2010, 9:41:23 PM5/10/10
to Ruby on Rails: Talk
Okay, last one.

I spoke too soon. It wasn't in the erubis gem, but a call back to
ActionView::Template::Handlers::Erubis's add_expr_literal method and a
false match on the pattern BLOCK_EXPR. See:

http://gist.github.com/396799

I think the do pattern may need word boundaries or whitespace
characters surrounding it. I should probably report this
somewhere . . .
Reply all
Reply to author
Forward
0 new messages