Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/63.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 Ruby on rails3:链接到不工作? “board”, :action=>take_turn', :id=>@board.id, :x=>col, :y=>row},:remote=>true do%>_Ruby On Rails_Ruby On Rails 3 - Fatal编程技术网

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"> 
              &nbsp;
            </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正在给你块版本。只要在他的代码后面放上你想去的任何东西,附加一个
,你就可以去了!