" botton_to"的正确语法参数Rails 4

时间:2014-02-15 16:44:00

标签: ruby-on-rails-4 link-to

我,我查看了文档和搜索文章,但是,我似乎没有“botton_to”的语法。

以下内容适用于link_for:

<%= link_to "Compute Slots", :controller => :autoslots, :action => :new, :day_id => @day %>

根据文档和问题的不同建议,我尝试了以下内容:

<%= button_to "Compute Slots", {:controller => :autoslots, :action => :new, :day_id => @day.id}, :class => "btn btn-default btnfixed", :method => :get %>

<%= button_to "Compute Slots", {:controller => :autoslots, :action => :new, :day_id => @day}, :class => "btn btn-default btnfixed", :method => :get %>

<%= button_to "Compute Slots", {:controller => :autoslots, :action => :new, :day_id => @day.id}, :class => "btn btn-default btnfixed", :method => :get %>

<%= button_to "Compute Slots", new_autoslot_path(@day), :class => "btn btn-default btnfixed", :method => :get %>

<%= button_to "Compute Slots", new_autoslot_path, :day_id => @day, :class => "btn btn-default btnfixed", :method => :get %>

还有一些其他的排列,但我似乎没有正确的语法来获得与link_to语法相同的结果。

任何人都可以提供帮助吗?

0 个答案:

没有答案