Hi guys, I''m having this problem with a simple route. I have this on my routes.rb resources :items do member do post ''price'' end end However, when I try to post to this route, I get this error: Started POST "/items/28/price" for 127.0.0.1 at 2011-02-20 18:52:10 -0300 ActionController::RoutingError (No route matches "/items/28/price"): Does anyone have any idea what am I doing wrong? Thanks a lot in advance. -- Leonardo Mateo. There''s no place like ~ -- 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.
Phil On Sun, Feb 20, 2011 at 4:07 PM, Leonardo Mateo <leonardomateo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:> Hi guys, > I''m having this problem with a simple route. I have this on my routes.rb > resources :items do > member do > post ''price'' > end > end > > However, when I try to post to this route, I get this error: > > Started POST "/items/28/price" for 127.0.0.1 at 2011-02-20 18:52:10 -0300 > > ActionController::RoutingError (No route matches "/items/28/price"): > > Does anyone have any idea what am I doing wrong? >First check: is this route listed when you do `rake routes | grep price` ?> > Thanks a lot in advance. > > -- > Leonardo Mateo. > There''s no place like ~ > > -- > 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 Sun, Feb 20, 2011 at 8:14 PM, Phil Crissman <phil.crissman-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Phil > > > On Sun, Feb 20, 2011 at 4:07 PM, Leonardo Mateo <leonardomateo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: >> >> Hi guys, >> I''m having this problem with a simple route. I have this on my routes.rb >> resources :items do >> member do >> post ''price'' >> end >> end >> >> However, when I try to post to this route, I get this error: >> >> Started POST "/items/28/price" for 127.0.0.1 at 2011-02-20 18:52:10 -0300 >> >> ActionController::RoutingError (No route matches "/items/28/price"): >> >> Does anyone have any idea what am I doing wrong? > > First check: is this route listed when you do `rake routes | grep price` ?Yes, it is. This is the output [kandalf@bifur depot]$ rake routes | grep price price_item POST /items/:id/price(.:format) {:action=>"price", :controller=>"items"}> >> >> Thanks a lot in advance. >>-- Leonardo Mateo. There''s no place like ~ -- 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.
Phil On Sun, Feb 20, 2011 at 5:31 PM, Leonardo Mateo <leonardomateo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:> On Sun, Feb 20, 2011 at 8:14 PM, Phil Crissman <phil.crissman-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > > > > Phil > > > > > > On Sun, Feb 20, 2011 at 4:07 PM, Leonardo Mateo <leonardomateo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > > > > wrote: > >> > >> Hi guys, > >> I''m having this problem with a simple route. I have this on my routes.rb > >> resources :items do > >> member do > >> post ''price'' > >> end > >> end > >> > >> However, when I try to post to this route, I get this error: > >> > >> Started POST "/items/28/price" for 127.0.0.1 at 2011-02-20 18:52:10 > -0300 > >> > >> ActionController::RoutingError (No route matches "/items/28/price"): > >> > >> Does anyone have any idea what am I doing wrong? > > > > First check: is this route listed when you do `rake routes | grep price` > ? > Yes, it is. This is the output > [kandalf@bifur depot]$ rake routes | grep price > price_item POST /items/:id/price(.:format) > {:action=>"price", :controller=>"items"} > >... that''s crazy, then. The route is there, looks to be configured just fine. No reason you should get a "no route matches" error, that I can see. In development mode you shouldn''t even need to restart the server, but you could always try that. From what you''ve posted so far, I can''t see that you''re doing anything wrong. Not sure why it wouldn''t be working.> > > >> > >> Thanks a lot in advance. > >> > > > -- > Leonardo Mateo. > There''s no place like ~ > > -- > 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.
try calling it using: curl <domain>/items/:id/price.html or price.json as needed. format is needed when you call a route from outside without using named_path route. hope this helps. -- Aldo On Sun, Feb 20, 2011 at 8:37 PM, Phil Crissman <phil.crissman-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:> > Phil > > > On Sun, Feb 20, 2011 at 5:31 PM, Leonardo Mateo <leonardomateo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote: > >> On Sun, Feb 20, 2011 at 8:14 PM, Phil Crissman <phil.crissman-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >> wrote: >> > >> > Phil >> > >> > >> > On Sun, Feb 20, 2011 at 4:07 PM, Leonardo Mateo < >> leonardomateo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >> > wrote: >> >> >> >> Hi guys, >> >> I''m having this problem with a simple route. I have this on my >> routes.rb >> >> resources :items do >> >> member do >> >> post ''price'' >> >> end >> >> end >> >> >> >> However, when I try to post to this route, I get this error: >> >> >> >> Started POST "/items/28/price" for 127.0.0.1 at 2011-02-20 18:52:10 >> -0300 >> >> >> >> ActionController::RoutingError (No route matches "/items/28/price"): >> >> >> >> Does anyone have any idea what am I doing wrong? >> > >> > First check: is this route listed when you do `rake routes | grep price` >> ? >> Yes, it is. This is the output >> [kandalf@bifur depot]$ rake routes | grep price >> price_item POST /items/:id/price(.:format) >> {:action=>"price", :controller=>"items"} >> >> > ... that''s crazy, then. The route is there, looks to be configured just > fine. No reason you should get a "no route matches" error, that I can see. > In development mode you shouldn''t even need to restart the server, but you > could always try that. > > From what you''ve posted so far, I can''t see that you''re doing anything > wrong. Not sure why it wouldn''t be working. > > >> > >> >> >> >> Thanks a lot in advance. >> >> >> >> >> -- >> Leonardo Mateo. >> There''s no place like ~ >> >> -- >> 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. >-- 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 Sun, Feb 20, 2011 at 9:24 PM, Aldo Nievas <aldo.nievas-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> try calling it using: > curl <domain>/items/:id/price.html or price.json as needed. > format is needed when you call a route from outside without using named_path > route.That didn''t work either, but I think that''s because curl is requesting a GET and the route is a POST. I don''t know what''s going on. Everything seems to be in the right place. -- Leonardo Mateo. There''s no place like ~ -- 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.
curl -X POST <domain>/items/:id/price.html or price.json -- Aldo On Mon, Feb 21, 2011 at 10:00 AM, Leonardo Mateo <leonardomateo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:> On Sun, Feb 20, 2011 at 9:24 PM, Aldo Nievas <aldo.nievas-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > > try calling it using: > > curl <domain>/items/:id/price.html or price.json as needed. > > format is needed when you call a route from outside without using > named_path > > route. > > That didn''t work either, but I think that''s because curl is requesting > a GET and the route is a POST. > I don''t know what''s going on. Everything seems to be in the right place. > > -- > Leonardo Mateo. > There''s no place like ~ > > -- > 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.
Excerpts from Phil Crissman''s message of Sun Feb 20 15:14:45 -0800 2011:> > Started POST "/items/28/price" for 127.0.0.1 at 2011-02-20 18:52:10 -0300 > > > > ActionController::RoutingError (No route matches "/items/28/price"): > First check: is this route listed when you do `rake routes | grep price` ?Second check: Confirm that your form really does have method=POST. -- med vänlig hälsning David J. Hamilton -- 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.
On Mon, Feb 21, 2011 at 2:15 PM, David J. Hamilton <groups-RNpBDse/2JlBDgjK7y7TUQ@public.gmane.org> wrote:> Excerpts from Phil Crissman''s message of Sun Feb 20 15:14:45 -0800 2011: >> > Started POST "/items/28/price" for 127.0.0.1 at 2011-02-20 18:52:10 -0300 >> > >> > ActionController::RoutingError (No route matches "/items/28/price"): >> First check: is this route listed when you do `rake routes | grep price` ? > > Second check: Confirm that your form really does have method=POST.Yes, it does. Anyway, I''ve just changed it to use the update action, it makes more sense anyway. However, I still don''t understand why it is happening. -- Leonardo Mateo. There''s no place like ~ -- 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.
Excerpts from Leonardo Mateo''s message of Tue Feb 22 17:12:06 -0800 2011:> On Mon, Feb 21, 2011 at 2:15 PM, David J. Hamilton <groups-RNpBDse/2JlBDgjK7y7TUQ@public.gmane.org> wrote: > > Excerpts from Phil Crissman''s message of Sun Feb 20 15:14:45 -0800 2011: > >> > Started POST "/items/28/price" for 127.0.0.1 at 2011-02-20 18:52:10 -0300 > >> > > >> > ActionController::RoutingError (No route matches "/items/28/price"): > >> First check: is this route listed when you do `rake routes | grep price` ? > > > > Second check: Confirm that your form really does have method=POST. > Yes, it does. Anyway, I''ve just changed it to use the update action, > it makes more sense anyway. > However, I still don''t understand why it is happening.Something I should have been more clear about: you want to make sure that your form element has its method attribute set to post, but you will also need to check that it does not have a hidden parameter generated by rails named _method with a value of, e.g. put. Unfortunately when you make this mistake of specifying a post route in config/routes but accidentally submitting to a synthetic "put" (very easy to do if using +form_for+), the log will still read “Started POST” and you will be given no indication of the problem. -- med vänlig hälsning David J. Hamilton -- 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.
David J. Hamilton wrote in post #986294:>> However, I still don''t understand why it is happening. > Something I should have been more clear about: you want to make sure > that your > form element has its method attribute set to post, but you will also > need to > check that it does not have a hidden parameter generated by rails named > _method > with a value of, e.g. put. > > Unfortunately when you make this mistake of specifying a post route in > config/routes but accidentally submitting to a synthetic "put" (very > easy to do > if using +form_for+), the log will still read Started POST and you will > be > given no indication of the problem.Wow - THANK YOU! I would have been scratching my head for hours on this one. Very non-obvious, and seemingly not well known. -- 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.