Hello,

I have this model.

city has_many stores
store belongs_to city

I created resources for them and mapped them as such, using nested
resources:

map.resources :cities, :has_many => :stores

But I wanted to make the stores available independant from the city,
so I added:

map.resources :stores

And, at this point I wonder:

- There is an algorithmic way to convert a normal resource to a nested
one:
    1) edit config/routes.rb and add the :has_many or the block, to
route it as nested.
    2) change all named routes to, in this case, city_stores_
{path,url}.
    3) edit controller, normally add a before_filter to get or find
the parent resource.
    4) edit all find and new methods from the controller to use the
parent.childs collection,
        to build or find the proper children resources.

So, is there a simple way to achieve this double purpose controller
without having to
create a new CityStoreController?

Any, howto, tutorial, screencast, mail, forum, blog-post, would be
very appreciated!

Thanks for reading till here, and thanks A LOT for the help you can
give.

--
Daniel



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to