Ruby on rails Ruby on rails3:链接到不工作? “board”, :action=>take_turn', :id=>@board.id, :x=>col, :y=>row},:remote=>true do%>
生成:Ruby on rails Ruby on rails3:链接到不工作? “board”, :action=>take_turn', :id=>@board.id, :x=>col, :y=>row},:remote=>true do%>,ruby-on-rails,ruby-on-rails-3,Ruby On Rails,Ruby On Rails 3,生成: <%= link_to "", { :controller => 'board', :action => 'take_turn', :id => @board.id, :x => col, :y => row }, :rem
<%= link_to "", { :controller => 'board',
:action => 'take_turn',
:id => @board.id,
:x => col,
:y => row }, :remote => true do %>
为什么它不能正常工作?它应该生成
herf=“board/take_turn?id=15&x=1&y=1”
这是因为您使用的是链接到的块版本。本例中的第一个参数应该是URL,而不是空字符串。这是因为您使用的是链接到
的块版本。本例中的第一个参数应该是URL,而不是空字符串。col,:y=>row),:remote=>true do%>
<a href="" action="take_turn" controller="board" id="15" x="0" y="1">
<div class="ttt_square">
</div>
</a>
#你的代码和资料在这里
我认为应该有效(您需要确保实际定义了board\u take\u turn\u path
col,:y=>row),:remote=>true do%>
#你的代码和资料在这里
我认为应该有效(您需要确保实际定义了
board\u take\u turn\u path
,您应该添加括号,以便正确使用符号,如下所示:
<%= link_to board_take_turn_path(@board, :x => col, :y => row) , :remote => true do %>
# Your code and stuff here
<% end %>
“board”,
:action=>take_turn',
:id=>@board.id,
:x=>col,
:y=>row},:remote=>true)do%>
否则,解释器无法理解哪些是正确的参数。
希望这能有所帮助。您应该添加括号以使其与您的符号正确匹配,如下所示:
<%= link_to board_take_turn_path(@board, :x => col, :y => row) , :remote => true do %>
# Your code and stuff here
<% end %>
“board”,
:action=>take_turn',
:id=>@board.id,
:x=>col,
:y=>row},:remote=>true)do%>
否则,解释器无法理解哪些是正确的参数。
希望这能有所帮助。我遇到语法错误,意外的tASSOC,当我去掉空字符串时,期待“}”=\将
link\u to
的参数也用括号括起来。为了详细说明,如果您有link\u to{…}do…
,Ruby无法确定您使用的是散列语法还是块语法(并假设它是块)link_to({…})do…
帮助它了解您的意思是要传递散列。当我清除空字符串时,我得到语法错误,意外的tASSOC,期望“}”=\将link\u to
的参数也用括号括起来。为了详细说明,如果您有link\u to{…}do…
,Ruby无法确定您使用的是散列语法还是块语法(并假设它是块)link_to({…})do…
帮助它了解您想要传递散列。我需要它是link_to的块版本,因为我有一个div,它是一个完整的linkwebdestroya正在给您块版本。只要在他的代码后面放上你想去的任何东西,附加一个
,你就可以去了!我需要它是link_to的块版本,因为我有一个div,它是一个完整的linkwebdestroya正在给你块版本。只要在他的代码后面放上你想去的任何东西,附加一个
,你就可以去了!