Fredrik Karlsson
2008-Mar-03 22:10 UTC
Confused newbe again.. with id instead of action in URL
Hi, I''m trying to generate a new action and is very confused by the error message I get. I am accessing http://localhost:3001/members/isactive/ and get this error message: ActiveRecord::RecordNotFound in MembersController#show Couldn''t find Member with ID=isactive How come? Shouldn''t I get the isactive action + view? /Fredrik -- "Give up learning, and put an end to your troubles." --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frerik, We can''t see the web server running on your local machine (localhost: 3001). You''ll need to provide a code sample.... Ken On Mar 3, 4:10 pm, "Fredrik Karlsson" <dargo...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > I''m trying to generate a new action and is very confused by the error > message I get. I am accessinghttp://localhost:3001/members/isactive/ > and get this error message: > > ActiveRecord::RecordNotFound in MembersController#show > > Couldn''t find Member with ID=isactive > > How come? Shouldn''t I get the isactive action + view? > > /Fredrik > > -- > "Give up learning, and put an end to your troubles."--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ryan Bigg (Radar)
2008-Mar-04 02:28 UTC
Re: Confused newbe again.. with id instead of action in URL
you''re using restful routing and you haven''t set up a route for isactive yet. On Tue, Mar 4, 2008 at 9:18 AM, Ken <ken.mckelvey-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Frerik, > > We can''t see the web server running on your local machine (localhost: > 3001). You''ll need to provide a code sample.... > > Ken > > On Mar 3, 4:10 pm, "Fredrik Karlsson" <dargo...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hi, > > > > I''m trying to generate a new action and is very confused by the error > > message I get. I am accessinghttp://localhost:3001/members/isactive/ > > and get this error message: > > > > ActiveRecord::RecordNotFound in MembersController#show > > > > Couldn''t find Member with ID=isactive > > > > How come? Shouldn''t I get the isactive action + view? > > > > /Fredrik > > > > -- > > "Give up learning, and put an end to your troubles." > > >-- Ryan Bigg http://www.frozenplague.net Feel free to add me to MSN and/or GTalk as this email. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Fredrik Karlsson
2008-Mar-04 06:38 UTC
Re: Confused newbe again.. with id instead of action in URL
Hi, Ok, this may very well be a routing problem, but I fail to do something about it. My config/routes.rb contained just the default ActionController::Routing::Routes.draw do |map| map.resources :members map.resources :members map.connect '':controller/:action/:id'' map.connect '':controller/:action/:id.:format'' end which does not seem to include my case. But, how do I fix this? Adding map.connect '':controller/:action'' either above or below the last default cases does nothing, and I cannot get an explicit map.connect ''members/inactive'', :controller => ''members'', :action => ''inactive'' to get me anywere. RoR wants to map the last entry to "id" rather than action. BTW, adding a fake ID, as in http://localhost:3001/members/inactive/1, works :-) /Fredrik On Tue, Mar 4, 2008 at 3:28 AM, Ryan Bigg (Radar) <radarlistener-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> you''re using restful routing and you haven''t set up a route for isactive > yet. > > > On Tue, Mar 4, 2008 at 9:18 AM, Ken <ken.mckelvey-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Frerik, > > > > We can''t see the web server running on your local machine (localhost: > > 3001). You''ll need to provide a code sample.... > > > > Ken > > > > > > On Mar 3, 4:10 pm, "Fredrik Karlsson" <dargo...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hi, > > > > > > I''m trying to generate a new action and is very confused by the error > > > message I get. I am accessinghttp://localhost:3001/members/isactive/ > > > > > > > > > and get this error message: > > > > > > ActiveRecord::RecordNotFound in MembersController#show > > > > > > Couldn''t find Member with ID=isactive > > > > > > How come? Shouldn''t I get the isactive action + view? > > > > > > /Fredrik > > > > > > -- > > > "Give up learning, and put an end to your troubles." > > > > > > > > -- > Ryan Bigg > http://www.frozenplague.net > Feel free to add me to MSN and/or GTalk as this email. > > > > >-- "Give up learning, and put an end to your troubles." --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Mike Garey
2008-Mar-04 06:45 UTC
Re: Confused newbe again.. with id instead of action in URL
On 3/4/08, Fredrik Karlsson <dargosch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hi, > > Ok, this may very well be a routing problem, but I fail to do > something about it. My config/routes.rb > contained just the default > > ActionController::Routing::Routes.draw do |map| > map.resources :members > > map.resources :members > map.connect '':controller/:action/:id'' > map.connect '':controller/:action/:id.:format'' > > end > > which does not seem to include my case. But, how do I fix this? Adding > map.connect '':controller/:action'' either above or below the last > default cases does nothing, andYou need to add a custom route. Remove your ''map.resources :members'' and replace it with: map.resources :members, :collection => { :inactive => :any } replace :any with either :get or :post, depending upon how you want to access it (or leave it as :any to allow either :get or :post) --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Fredrik Karlsson
2008-Mar-04 08:22 UTC
Re: Confused newbe again.. with id instead of action in URL
Exellent! This did the trick. Now, where do I learn about these new routes? /Fredrik On Tue, Mar 4, 2008 at 7:45 AM, Mike Garey <random52k-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > On 3/4/08, Fredrik Karlsson <dargosch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Hi, > > > > Ok, this may very well be a routing problem, but I fail to do > > something about it. My config/routes.rb > > contained just the default > > > > ActionController::Routing::Routes.draw do |map| > > map.resources :members > > > > map.resources :members > > map.connect '':controller/:action/:id'' > > map.connect '':controller/:action/:id.:format'' > > > > end > > > > which does not seem to include my case. But, how do I fix this? Adding > > map.connect '':controller/:action'' either above or below the last > > default cases does nothing, and > > You need to add a custom route. Remove your ''map.resources :members'' > and replace it with: > > map.resources :members, :collection => { :inactive => :any } > > replace :any with either :get or :post, depending upon how you want to > access it (or leave it as :any to allow either :get or :post) > > > > > >-- "Give up learning, and put an end to your troubles." --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
You can find RESTful Rails documentation everywhere on the net via google. I found these two PDF documents on it for you: http://www.b-simple.de/download/restful_rails_en.pdf http://topfunky.com/clients/peepcode/REST-cheatsheet.pdf the second is a cheatsheet, so it''s concise and contains only essential examples --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---