Hi Rails experts, I have one doubt regarding map.resources. I am not clear with when to use :method and :collection in map.resources. Please help me out. 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 -~----------~----~----~----~------~----~------~--~---
http://guides.rails.info/routing/routing_outside_in.html On Wed, Oct 1, 2008 at 12:00 PM, Nilesh Kumar <email2nilez-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi Rails experts, > > I have one doubt regarding map.resources. > I am not clear with when to use :method and :collection in > map.resources. Please help me out. > > Thanks. > > > >-- Cheers! - Pratik http://m.onkey.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Nilesh Kumar wrote:> Hi Rails experts, > > I have one doubt regarding map.resources. > I am not clear with when to use :method and :collection in > map.resources. Please help me out. > > Thanks.method is for adding new actions that deal with a single instance of the mode in question. collection is for adding new methods that deal with, well, a collection of the model in question. I have: map.resources :projects, {:collection => {:recent => :get}, :member => {:copy => :get, :pdf => :get}} so I have a "recent projects" that works on the collection of projects(returning the most recent 10), and "copy" and "pdf" that work on an individual project. -- 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 -~----------~----~----~----~------~----~------~--~---
Thanks Pratik for ur reply! On Wed, Oct 1, 2008 at 6:07 PM, Pratik <pratiknaik-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > http://guides.rails.info/routing/routing_outside_in.html > > On Wed, Oct 1, 2008 at 12:00 PM, Nilesh Kumar <email2nilez-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > > Hi Rails experts, > > > > I have one doubt regarding map.resources. > > I am not clear with when to use :method and :collection in > > map.resources. Please help me out. > > > > Thanks. > > > > > > > > > > > -- > Cheers! > - Pratik > http://m.onkey.org > > > >--~--~---------~--~----~------------~-------~--~----~ 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 Chron for ur reply! On Wed, Oct 1, 2008 at 6:16 PM, Ar Chron <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>wrote:> > Nilesh Kumar wrote: > > Hi Rails experts, > > > > I have one doubt regarding map.resources. > > I am not clear with when to use :method and :collection in > > map.resources. Please help me out. > > > > Thanks. > > method is for adding new actions that deal with a single instance of the > mode in question. > > collection is for adding new methods that deal with, well, a collection > of the model in question. > > I have: > > map.resources :projects, {:collection => {:recent => :get}, :member => > {:copy => :get, :pdf => :get}} > > so I have a "recent projects" that works on the collection of > projects(returning the most recent 10), and "copy" and "pdf" that work > on an individual project. > -- > 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 -~----------~----~----~----~------~----~------~--~---