Reputation: 807
Alright, getting a pretty bizarre routing error here.
No route matches {:controller=>"subscriptions", :action=>"change"}
Extracted source (around line #22):
19: <td><%= s.product.name %></td>
20: <td><%= s.calc_time_to_next_arrival %></td>
21: <td>
22: <%= form_for(:subscription, s, :url => { :action => "change" }, :id => s) do %>
23: <%= label_tag(:q, "Days to delay:") %>
24: <%= text_field_tag(:query) %>
25: <%= check_box_tag(:always) %>
And yet if I run rake routes this is what I get
change_subscription GET /subscriptions/:id/change(.:format {:controller=>"subscriptions", :action=>"change"}
Pretty sure that means it should be there. Not sure what is going on.
Here is where the route is stated in routes.rb
resources :subscriptions do
member do
get 'change'
end
end
Here's the controller though for subscriptions
def change
@subscription = Subscription.find(params[:id])
@subscription.change(:query, :always)
redirect_to :back
end
Upvotes: 2
Views: 1255
Reputation: 47548
That should be post 'change'
, instead of get 'change'
Er, I meant put 'change'
, of course.
How about:
<%= form_for s, :url => change_subscription_path(s) do |f| %>
Upvotes: 4