Results 1 to 2 of 2
Thread: nested routes + scaffolding
Oct 1, 2008, 21:29 #1
nested routes + scaffolding
I'm trying to understand nested routes at the moment.
I generated these three models with the scaffold generator:
class Category < ActiveRecord::Base has_many :topics end class Topic < ActiveRecord::Base belongs_to :category has_many :posts end class Post < ActiveRecord::Base belongs_to :topic end
map.resources :categories do |categories| categories.resources :topics do |topics| topics.resources :posts end end
Is there any way to make this easier and less error prone?
I know it's not a good idea to have to deeply nested routes. But otherwise I don't know how to get all needed information. To create a topic for example I need the category_id ...
Thanks for any advices.
Oct 2, 2008, 09:32 #2