I compared the output from ``rake routes’’ for each solution below,
and they both produce the exact same routes. Is one solution preferred
over the over?
Solution #1:
map.resource :account do |account|
account.resources :properties, :controller => ‘account/properties’
account.resources :photos, :controller => ‘account/photos’
end
Solution #2:
map.resource :account
map.namespace :account do |account|
account.resources :photos
account.resources :properties
end
I guess you have the answer in your question… You don’t need the
controller part so it would look like this:
map.resource :account do |account|
account.resources :properties
account.resources :photos
end
Hi Freddy. Leaving out the :controller part results in the properties
and photos nested resources using their non-namespaced controllers: http://rafb.net/p/lODGyE45.html
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.