Hi RoR gurus, For my project, I have been trying to create the resources with the following urls: hxxp://domain/projects/active [for active projects] hxxp://domain/projects/archived [for archived projects] Subsequently, I created the public methods active and archived in the ProjectController and created the related views. I also added the following route in the routes.rb - map.connect ":controller/:action" to the already existing default routes. However when I click on the links for the active and archived projects, it throws me an error ''Couldn''t find Project with ID=active''. Am I missing something? Or is this sort of thing not permitted and we are expected to use only the 7 golden actions? TiA KoPoS --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Mea Culpa. I had completely forgotten about the default routes created by the map.resources method. To move around the error, I had to just add my route right at the top. The code works like a charm now! Cheers. On Mar 25, 11:44 pm, KoPoS <poorna.shash...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi RoR gurus, > > For my project, I have been trying to create the resources with the > following urls: > hxxp://domain/projects/active [for active projects] > hxxp://domain/projects/archived [for archived projects]--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
This change though breaks the show action of the form - http://<domain>/projects/1>> link_to(''Project'', project)Anyone has any other ideas? On Mar 26, 12:03 am, KoPoS <poorna.shash...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Mea Culpa. > > I had completely forgotten about the default routes created by the > map.resources method. To move around the error, I had to just add my > route right at the top.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
KoPoS wrote:> I also added the following route in the routes.rb > - map.connect ":controller/:action" > to the already existing default routes.Instead of this, add your actions to the existing resources for projects: map.resources :projects, :collection => [:active, :archived] This will add them as special cases under /projects and assume there is no specific id to operate on. For more information, take a look at: http://api.rubyonrails.com/classes/ActionController/Resources.html#M000308 This will give you details about the :collection and :member options to resources and also how to restrict these actions to particular HTTP methods. -- 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-/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 -~----------~----~----~----~------~----~------~--~---