Nested Resources vs. Normal Resources

Hi,

I’m a bit unsure as to when one uses a nested resource and when one
uses a normal resource. If you have a belongs_to, has_one/many
relationship between models is that automatically an indication of a
nested resource or can these resources still be represented in the
normal resource way?

I have a resource (talker) that belongs_to a number of other models
(network, data_date, talker_type etc) in a many to one relationship
and I’d like to be able to have something like:

/networks/1/talkers/10
/data_dates/1/talkers/10
/talker_types/1/talkers/10

but also

/talkers/10

Is it possible to do this? or do I need to rename each of the nested
parts of the url to something like network_talkers etc. so that it
would be:

/networks/1/network_talkers/10

?

Thanks,
Toby

Don’t use nested resource unless you have a valid reason.

http://groups.google.com/group/rubyonrails-core/browse_thread/thread/f4ca7b1d420f6d7d/63a18f62d6cc7364?q=Nested+Resource&lnk=ol&
is a nice read.

On 8/3/07, [email protected] [email protected] wrote:

(network, data_date, talker_type etc) in a many to one relationship
Is it possible to do this? or do I need to rename each of the nested


Cheers!