I have seen the new way to define RESTful routes. How would you define
the following routes in the newstyle?
map.resources :dinners do |dinner|
dinner.resources :dishes do |dish|
dish.resources :side_courses
end
end
Any ideas?
Thanks!
Chris
I have seen the new way to define RESTful routes. How would you define
the following routes in the newstyle?
map.resources :dinners do |dinner|
dinner.resources :dishes do |dish|
dish.resources :side_courses
end
end
Any ideas?
Thanks!
Chris
Chris W. wrote:
I have seen the new way to define RESTful routes. How would you define
the following routes in the newstyle?map.resources :dinners do |dinner|
dinner.resources :dishes do |dish|
dish.resources :side_courses
end
endAny ideas?
That’s totally current and up-to-date for Rails 2.0. If by “new way”
you mean the :has_many and :has_one options, those are just shortcuts
for nesting resources or singular resource, respectively. I don’t think
you can do multiple levels that way though.
–
Josh S.
http://blog.hasmanythrough.com
The :has_one and :has_many are the shortcuts I was eluding to. Just
making sure I am doing things the correct way with Rails 2.0.
Thanks
Chris
Josh S. wrote:
Chris W. wrote:
I have seen the new way to define RESTful routes. How would you define
the following routes in the newstyle?map.resources :dinners do |dinner|
dinner.resources :dishes do |dish|
dish.resources :side_courses
end
endAny ideas?
That’s totally current and up-to-date for Rails 2.0. If by “new way”
you mean the :has_many and :has_one options, those are just shortcuts
for nesting resources or singular resource, respectively. I don’t think
you can do multiple levels that way though.–
Josh S.
http://blog.hasmanythrough.com
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs