In routes.rb I have this:
resources :presentations do
post “save_stuff”, :on => :member
end
In PresentationsController I have this:
def save_stuff
…
end
And in my form I have this:
<%= form_for @presentation, :url => {:action => “save_stuff”}, :html =>
{:id => “presentationForm”, :method => :post} do |f| %>
Yet when an attempt is made to render the above form I get this:
!! Unexpected error while processing request: No route matches
{:action=>“save_stuff”, :controller=>“presentations”}
I have been struggling with this for hours, so I could use some help.
Thanks.
On May 15, 2012, at 6:53 PM, Neil C. wrote:
end
I have been struggling with this for hours, so I could use some help.
What do you see when you type rake routes in Terminal?
Walter
I haven’t seen the :on syntax before. Have you tried it like this?
resources :presentations do
member do
post “save_stuff”
end
end
On May 15, 11:53pm, Neil C. [email protected] wrote:
end
I have been struggling with this for hours, so I could use some help.
You’ve said that save_stuff is a member thing, so rails needs to know
which presentation you want to save stuff on. The :url option
completely overrides the route that would normally be generated (to
the update action) so you need to specify the id as well. You could
also use the named route - :url =>
save_stuff_presentation_path(@presentation)
Fred