2010-09-21 20 views
1
<%= link_to 'Testing', wak_path %> 

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

他們是否拿出這個出來的軌道3.0或發生了什麼?Ruby on Rails 3 link_to - 爲什麼我會得到不同的html鏈接?

<%= link_to 'Testing, :controller=>:home,:actions=>:wak %> 

但在看法,我得到兩個不同的代碼,上面方法的作品,雖然這麼想的具有相同的行爲,第二種方法。爲什麼是這樣?

我只是做了一些測試,這就是我改變參數時所提出的。和我得到的輸出。

<%= 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> 

回答

2

使用:動作來代替:行爲,這是不正確

相關問題