# Link\_to error in beta3

**URL:** <https://www.ruby-forum.com/t/link-to-error-in-beta3/188354>\
**Category:** Rails\
**Created:** [May 10, 2010, 6:26pm UTC](https://www.ruby-forum.com/t/link-to-error-in-beta3/188354 "2010-05-10T18:26:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [May 10, 2010, 6:26pm UTC](https://www.ruby-forum.com/t/link-to-error-in-beta3/188354/1 "2010-05-10T18:26:15Z")

</div>

Can anybody take a quick look at the following problem, occurring with  
beta3 on Ruby 1.9.2 ?

> <https://gist.github.com/anonymous/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.

---

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [May 11, 2010, 1:24am UTC](https://www.ruby-forum.com/t/link-to-error-in-beta3/188354/2 "2010-05-11T01:24:16Z")

</div>

This is weird.

Check this out:

> <https://gist.github.com/anonymous/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:

> <https://gist.github.com/anonymous/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 . . .

---

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [May 11, 2010, 3:07am UTC](https://www.ruby-forum.com/t/link-to-error-in-beta3/188354/3 "2010-05-11T03:07:18Z")

</div>

I updated the gist with additional information:

> <https://gist.github.com/anonymous/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(‘\n ’);  
@output\_buffer.append= ( link\_to ‘Show’, todx );  
@output\_buffer.safe\_concat(‘\n ’);

But when the variable name is ‘todo’ the output is:

@output\_buffer.safe\_concat(‘\n ’);  
@output\_buffer.append= link\_to ‘Show’, todo  
@output\_buffer.safe\_concat(‘\n ’);

It’s mangled; I wonder if it’s matching “do” somewhere?

---

<div class="post-metadata">

**Author:** ![mike](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/58f4c7/32.png) [@mike](https://www.ruby-forum.com/u/mike)\
**Post date:** [May 11, 2010, 3:43am UTC](https://www.ruby-forum.com/t/link-to-error-in-beta3/188354/4 "2010-05-11T03:43:03Z")

</div>

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:

> <https://gist.github.com/anonymous/396799>

I think the do pattern may need word boundaries or whitespace  
characters surrounding it. I should probably report this  
somewhere . . .
