It seems from the rest of the etiquette on this forum I'm supposed to
tell you here to top-quote when replying ;p

On Jan 19, 7:05 pm, Mike C <[email protected]> wrote:
> Thanks for the link to the nested resource thing, it was an
> interesting read. So I take it that it's a good idea to define both a
> nested resource and an independent one for any resource that needs to
> be nested?

It depends on the resource and how you want to access it, but I
generally do.

I didn't see it mentioned in here, but if you don't use something like
make_resourceful or inherited_resource you should consider it to DRY
up your CRUD based controllers.  The reason I mention that is that if
you use those then nested or not your controller code wouldn't change
(if you don't want to use one you can always copy their design pattern
to allow the same axiom of your code).  Then it becomes a question of
routes and of what you want to type for the path.  I.e. do you want to
do
a_b_path(@a, @b)
That means that you'll have the nested one because you need it (for
create and index for sure) and then you can decide whether you want to
enforce it for show as well (i.e. hide the Bs/1 URL

, whether you have the un-nested route or not really is just a matter
of if you want to expose that URL, since the controller won't change
at all.

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to