i''ve done a few project using restful routing but now i need to add an action that isn''t part of one of the main crud methods. i added this to my routes.rb file: map.resources :works, :collection => { :featured => :get } and have a "featured" action in the works controller. but for some reason everytime i try to go to http://localhost:3000/works/featured, i get an unknown action error. looking at the log file, it''s trying to find this page: Parameters: {"action"=>"show", "id"=>"featured", "controller"=>"works"} is there something i did wrong or something i missed in order to make this work? thanks. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
map.feature ''works/featured'', :controller => ''works'', :action => ''featured'' then user feature_url or feature_path to get at a link to it. I hope this gets you where you need to be headed. Amos On 9/16/07, Josh <jjkiesch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > i''ve done a few project using restful routing but now i need to add an > action that isn''t part of one of the main crud methods. > > i added this to my routes.rb file: > > map.resources :works, :collection => { :featured => :get } > > and have a "featured" action in the works controller. but for some > reason everytime i try to go to http://localhost:3000/works/featured, > i get an unknown action error. looking at the log file, it''s trying to > find this page: > > Parameters: {"action"=>"show", "id"=>"featured", > "controller"=>"works"} > > is there something i did wrong or something i missed in order to make > this work? > > thanks. > > > > >-- Amos King A. King Software Development and Consulting, L.C. http://dirtyInformation.com -- Looking for something to do? Visit http://ImThere.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-/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 would have to use the URL: http://localhost:3000/works;featured On Sep 16, 2:35 pm, Josh <jjkie...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> i''ve done a few project using restful routing but now i need to add an > action that isn''t part of one of the main crud methods. > > i added this to my routes.rb file: > > map.resources :works, :collection => { :featured => :get } > > and have a "featured" action in the works controller. but for some > reason everytime i try to go tohttp://localhost:3000/works/featured, > i get an unknown action error. looking at the log file, it''s trying to > find this page: > > Parameters: {"action"=>"show", "id"=>"featured", > "controller"=>"works"} > > is there something i did wrong or something i missed in order to make > this work? > > thanks.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
thanks. yeah i was just trying to access the url wrong. On Sep 16, 6:34 pm, eggie5 <egg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> You would have to use the URL: > > http://localhost:3000/works;featured > > On Sep 16, 2:35 pm, Josh <jjkie...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > i''ve done a few project using restful routing but now i need to add an > > action that isn''t part of one of the main crud methods. > > > i added this to my routes.rb file: > > > map.resources :works, :collection => { :featured => :get } > > > and have a "featured" action in the works controller. but for some > > reason everytime i try to go tohttp://localhost:3000/works/featured, > > i get an unknown action error. looking at the log file, it''s trying to > > find this page: > > > Parameters: {"action"=>"show", "id"=>"featured", > > "controller"=>"works"} > > > is there something i did wrong or something i missed in order to make > > this work? > > > thanks.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---