I’m wondering how or if it is possible to nest a resource more than
one level.
routes.rb
map.namespace :blog do |blog|
blog.resources :channels, :has_many => :articles
end
For example, how could I say that would like each article to have
nested comments.
map.namespace :blog do |blog|
blog.resources :channels, :has_many
=> :articles ?? :has_many :comments
end
I’m thinking the url would look something like:
/blog/channel/1/article/1/comment/1
Thanks,
resident moron
There is another way of doing :has_many that is this way:
map.resources :posts do |post|
post.resources :comments
end
This way your route will be something like this:
map.namespace :blog do |blog|
map.resources :channels do |channel|
channel.resources :articles do |article|
article.resources :comments
end
end
end
On May 8, 2008, at 6:10 PM, rails.impaired wrote:
For example, how could I say that would like each article to have
Thanks,
resident moron
–
Rafael Gaspar - [email protected]
http://rafaelcanhasblog.com