Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/57.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 为什么不起作用:link_to(当前_用户)do_Ruby On Rails - Fatal编程技术网

Ruby on rails 为什么不起作用:link_to(当前_用户)do

Ruby on rails 为什么不起作用:link_to(当前_用户)do,ruby-on-rails,Ruby On Rails,为什么会出现意外情况?因为link\u to标记开头的=意味着获取此标记中的内容并将其作为字符串输出,因此错误消息中的to也是如此。因为link\u to标记开头的=意味着获取此标记中的内容并将其作为字符串输出,因此错误消息中的to是正确的,你只需要去掉=就可以了。没错,你只需要去掉=就可以了。 <%= link_to(current_user) do %> #show other stuff between anchors like this: #<a href="/

为什么会出现意外情况?

因为link\u to标记开头的=意味着获取此标记中的内容并将其作为字符串输出,因此错误消息中的to也是如此。

因为link\u to标记开头的=意味着获取此标记中的内容并将其作为字符串输出,因此错误消息中的to是正确的,你只需要去掉=就可以了。没错,你只需要去掉=就可以了。
<%= link_to(current_user) do %>
  #show other stuff between anchors like this:
  #<a href="/user/bob">show other stuff between anchors</a>
<% end %>
compile error
syntax error, unexpected ')'
...t(( link_to(current_user) do ).to_s); @output_buffer.concat ...