开发者

Why does this not work: link_to(current_user) do

开发者 https://www.devze.com 2022-12-09 01:25 出处:网络
<%= link_to(current_user) do %> #show other stuff between anchors like this: #<a href=\"/user/bob\">show other stuff between anchors</a>
<%= link_to(current_user) do %>
  #show other stuff between anchors like this:
  #<a href="/user/bob">show other stuff between anchors</a>
<% end %>

The error I get is:

compile error
syntax error, unexpected开发者_开发百科 ')'
...t(( link_to(current_user) do ).to_s); @output_buffer.concat ...

Why an unexpected ')'?


Because the "=" at the beginning of the link_to tag implies "take what's in this tag and output it as a string" (hence the "to_s" in the error message).

0

精彩评论

暂无评论...
验证码 换一张
取 消