I''m getting a RoutingError for a member route I can''t figure
out. I''m
posting a simple form that has a submit button as a confirmation step.
Here''s the route:
# routes.rb
resources :orders do
post ''confirm'', :on => :member
end
1) "rake routes" shows it''s there:
confirm_order POST /orders/:id/confirm(.:format)
{:action=>"confirm", :controller=>"orders"}
2) Controller Orders defines confirm
3) HTML output shows the form is correctly set to post with action "/
orders/3/confirm"
4) Request header on the Routing Error page shows "POST /orders/3/
confirm HTTP/1.1"
5) My functional test passes: "post :confirm, :id =>
@order.to_param, :order => @order.attributes"
6) All other routes in routes.rb are disabled except the above
Everything seems to be correct but it''s not working:
No route matches "/orders/3/confirm"
If I change the request method on the route to "get" and simply view
in the browser it works. Help? :)
--
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.
Okay, I see now. There''s a hidden input "_method" with value "put" output automatically with my form. I needed to change my route to use "put" instead of "post" to match what''s happening behind the scenes. My functional test was working with post so I couldn''t see anything wrong there, and it''s odd because checking everything at the endpoints showed a failed post request and not a (silent) put request. I had thought about using put and this is probably more technically correct because I''m modifying an existing object. On Mar 2, 3:08 pm, djangst <djan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''m getting a RoutingError for a member route I can''t figure out. I''m > posting a simple form that has a submit button as a confirmation step.-- 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.
Apparently Analagous Threads
- Beginer: Question about routing on Rails 3
- [Rails 3] No route matches error using RSpec even though route DOES match
- nested route not receiving :id parameter within controller spec
- RoutingError with RSpec Controller test on Scoped Route
- Rspec and restful routes