ptontiger
2007-Dec-11 23:40 UTC
Lost in translation - Rails 2.0 Nested Resources, Custom Actions
The shift to the :has_many and :has_one options when defining nested
resource routes has me perplexed. The block format allows me to define
custom REST actions like publish in the example below:
map.resources :users do |user|
user.resources :articles, :member => { :publish => :put }
end
It also allows for multiple levels of nesting if necessary.
What I''d really like to know is how do I enable custom REST actions
for nested resources using the newer options technique?
map.resources :users, :has_many => :articles # ... <?> :member =>
{ :publish => :put } </?>
Thanks in advance.
--~--~---------~--~----~------------~-------~--~----~
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
2007-Dec-12 00:10 UTC
Re: Lost in translation - Rails 2.0 Nested Resources, Custom Actions
map.resources :users do |user|
user.resources :articles, :member => { :publish => :put }
end
seems to be the only way to do it at the moment.
On Dec 12, 2007 10:10 AM, ptontiger
<ptontiger-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> The shift to the :has_many and :has_one options when defining nested
> resource routes has me perplexed. The block format allows me to define
> custom REST actions like publish in the example below:
>
> map.resources :users do |user|
> user.resources :articles, :member => { :publish => :put }
> end
>
> It also allows for multiple levels of nesting if necessary.
>
> What I''d really like to know is how do I enable custom REST
actions
> for nested resources using the newer options technique?
>
> map.resources :users, :has_many => :articles # ... <?> :member
=>
> { :publish => :put } </?>
>
> Thanks in advance.
> >
>
--
Ryan Bigg
http://www.frozenplague.net
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
ptontiger
2007-Dec-12 00:22 UTC
Re: Lost in translation - Rails 2.0 Nested Resources, Custom Actions
Thanks Ryan, that''s what I figured. That being the case, is the newer options definition slated to be a replacement for the block definition or will there continue to be coexistence? On Dec 11, 7:10 pm, "Ryan Bigg" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> map.resources :users do |user| > user.resources :articles, :member => { :publish => :put } > end > > seems to be the only way to do it at the moment. > > On Dec 12, 2007 10:10 AM, ptontiger <ptonti...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > The shift to the :has_many and :has_one options when defining nested > > resource routes has me perplexed. The block format allows me to define > > custom REST actions like publish in the example below: > > > map.resources :users do |user| > > user.resources :articles, :member => { :publish => :put } > > end > > > It also allows for multiple levels of nesting if necessary. > > > What I''d really like to know is how do I enable custom REST actions > > for nested resources using the newer options technique? > > > map.resources :users, :has_many => :articles # ... <?> :member => > > { :publish => :put } </?> > > > Thanks in advance. > > -- > Ryan Bigghttp://www.frozenplague.net--~--~---------~--~----~------------~-------~--~----~ 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
2007-Dec-12 00:31 UTC
Re: Lost in translation - Rails 2.0 Nested Resources, Custom Actions
At a guess there will continue to be co-existance. I guess the :has_many and so on are only useful for when that related object has only the default 7 actions. On Dec 12, 2007 10:52 AM, ptontiger <ptontiger-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Thanks Ryan, that''s what I figured. That being the case, is the newer > options definition slated to be a replacement for the block definition > or will there continue to be coexistence? > > On Dec 11, 7:10 pm, "Ryan Bigg" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > map.resources :users do |user| > > user.resources :articles, :member => { :publish => :put } > > end > > > > seems to be the only way to do it at the moment. > > > > On Dec 12, 2007 10:10 AM, ptontiger <ptonti...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > > > The shift to the :has_many and :has_one options when defining nested > > > resource routes has me perplexed. The block format allows me to define > > > custom REST actions like publish in the example below: > > > > > map.resources :users do |user| > > > user.resources :articles, :member => { :publish => :put } > > > end > > > > > It also allows for multiple levels of nesting if necessary. > > > > > What I''d really like to know is how do I enable custom REST actions > > > for nested resources using the newer options technique? > > > > > map.resources :users, :has_many => :articles # ... <?> :member => > > > { :publish => :put } </?> > > > > > Thanks in advance. > > > > -- > > Ryan Bigghttp://www.frozenplague.net > > >-- Ryan Bigg http://www.frozenplague.net --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
gsterndale
2007-Dec-21 16:28 UTC
Re: Lost in translation - Rails 2.0 Nested Resources, Custom Actions
I''m having similar frustrations. map.resources :users, :has_many => [:fingers], :has_one => [:nose] map.resources :users do |users| users.resources :peepers, :controller => ''eyes'' # So we can call eyes ''peepers'' in the site URLs end I have to use the old block format to specify a different controller name. Any ideas? On Dec 11, 7:31 pm, "Ryan Bigg" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> At a guess there will continue to be co-existance. I guess the :has_many and > so on are only useful for when that related object has only the default 7 > actions. > > On Dec 12, 2007 10:52 AM, ptontiger <ptonti...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > Thanks Ryan, that''s what I figured. That being the case, is the newer > > options definition slated to be a replacement for the block definition > > or will there continue to be coexistence? > > > On Dec 11, 7:10 pm, "Ryan Bigg" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > map.resources :users do |user| > > > user.resources :articles, :member => { :publish => :put } > > > end > > > > seems to be the only way to do it at the moment. > > > > On Dec 12, 2007 10:10 AM, ptontiger <ptonti...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > The shift to the :has_many and :has_one options when defining nested > > > > resource routes has me perplexed. The block format allows me to define > > > > custom REST actions like publish in the example below: > > > > > map.resources :users do |user| > > > > user.resources :articles, :member => { :publish => :put } > > > > end > > > > > It also allows for multiple levels of nesting if necessary. > > > > > What I''d really like to know is how do I enable custom REST actions > > > > for nested resources using the newer options technique? > > > > > map.resources :users, :has_many => :articles # ... <?> :member => > > > > { :publish => :put } </?> > > > > > Thanks in advance. > > > > -- > > > Ryan Bigghttp://www.frozenplague.net > > -- > Ryan Bigghttp://www.frozenplague.net--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---