Reputation: 6244
Why would this work?
<%= link_to "New Item", new_site_care_path, {:class => "button_bottom"} %>
And this (the only change is from link_to to button_to)...
<%= button_to "New Item", :url => new_site_care_path, {:class => "button_bottom"} %>
...produces:
No route matches "/site_cares/new"
UPDATE - ROUTE INFO - route file:
resources :site_cares, :except => :show
rake routes:
new_site_care GET /site_cares/new(.:format) {:action=>"new", :controller=>"site_cares"}
Upvotes: 1
Views: 1189
Reputation: 24236
I think that button_to
uses post by default, my ROR route skills are a bit rusty but I think the route you've shown uses GET.
There's further info in this question - Button_to in Ruby on Rails bad route
Upvotes: 2