Topic: Nested route

Hi, 

If I use a nested route do I then not have to use a find "where" in the controller index action? (relationships are already set up in the models).

Thanks!

Re: Nested route

I'm not sure how you think it should liberate you from using where in the index action, but anyway - no. Routing has nothing to do with what action itself does. smile

Re: Nested route

http://guides.rubyonrails.org/routing.html
2.7 Nested Resources

class Magazine < ActiveRecord::Base
  has_many :ads
end

class Ad < ActiveRecord::Base
  belongs_to :magazine
end

Nested routes allow you to capture this relationship in your routing. In this case, you could include this route declaration:
resources :magazines do
  resources :ads
end
I'm just trying to figure out routing...

Last edited by dcastellano1 (2011-01-24 20:17:05)

Re: Nested route

Nested routing is about routes, not about the behavior of your actions.