Ruby on rails RubyonRails3.0为什么这两个输出两个不同的东西? *这需要一个路由:匹配'wak',:to=>'home#wak'

Ruby on rails RubyonRails3.0为什么这两个输出两个不同的东西? *这需要一个路由:匹配'wak',:to=>'home#wak',ruby-on-rails,Ruby On Rails,他们是从rails 3.0中删除的还是正在发生的事情 <%= link_to 'Testing', wak_path %> *This requires a routes: match 'wak', :to => 'home#wak' :home,:actions=>:test},:remote=>true%> {:controller=>:home,:actions=>:test},:remote=>true%> 在第二种方法中,您忘记关闭测试报价。应该是 <%=

他们是从rails 3.0中删除的还是正在发生的事情

<%= link_to 'Testing', wak_path %>

*This requires a routes: match 'wak', :to => 'home#wak'

:home,:actions=>:test},:remote=>true%>
{:controller=>:home,:actions=>:test},:remote=>true%>

在第二种方法中,您忘记关闭测试报价。应该是

<%= link_to 'hello', test_path, :remote=>true%>
<a href="/test" data-remote="true">hello</a> 

<%= link_to 'hello', {:controller=>:home,:actions=>:test}, :remote=>true%>
<a href="/home/index?actions=test" data-remote="true">hello</a> 


<%= link_to 'hello', :url=>{:controller=>:home,:actions=>:test}, :remote=>true%>
<a href="/home/index?url[controller]=home&amp;url[actions]=test&amp;remote=true">hello</a>
:home,:actions=>:wak%>

在rails 3中,第二种方法可以正常工作,您还可以通过在命令行中写入rake routes来检查路由,并检查每个路由助手方法是否与controller-action匹配。

测试后缺少引号?

:action而不是:actions

它仍然没有产生预期的结果。我已经把我得到的印在上面了。
<%= link_to 'hello', test_path, :remote=>true%>
<a href="/test" data-remote="true">hello</a> 

<%= link_to 'hello', {:controller=>:home,:actions=>:test}, :remote=>true%>
<a href="/home/index?actions=test" data-remote="true">hello</a> 


<%= link_to 'hello', :url=>{:controller=>:home,:actions=>:test}, :remote=>true%>
<a href="/home/index?url[controller]=home&amp;url[actions]=test&amp;remote=true">hello</a>
<%= link_to 'Testing', :controller=>:home,:actions=>:wak %>