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. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On May 15, 2012, at 6:53 PM, Neil Chaudhuri wrote:> 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.What do you see when you type rake routes in Terminal? Walter -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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 Tue, May 15, 2012 at 7:56 PM, Walter Lee Davis <waltd-HQgmohHLjDZWk0Htik3J/w@public.gmane.org>wrote:> > On May 15, 2012, at 6:53 PM, Neil Chaudhuri wrote: > > > 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. > > What do you see when you type rake routes in Terminal? > > Walter > > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On May 15, 11:53 pm, Neil Chaudhuri <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> 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. >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 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I have the same problem. Any ideas ? On Wednesday, May 16, 2012 12:53:58 AM UTC+2, Ruby-Forum.com User wrote:> > 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. > > -- > Posted via http://www.ruby-forum.com/. >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/fb4dae47-4718-4eda-a7e2-35856ef40a03%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.