Hello-
I’m working on an e-commerce app. Specifically, I’m working on how
addresses are managed. An Order has_one Address. A User has_many
Addresses. I defined some routes that look like this:
map.resources :orders, :has_one => [:address, :credit_card]
map.resources :users do |user|
user.resources :addresses
user.resources :credit_cards
end
The issues is that my orders route is accessing the address like a
singleton and my users route is accessing it like a normal resource.
What is the best way to handle this? Should I have one controller that
can be used in both situations? Should I create two controllers, one
singleton and one regular? Any other approaches that I might be
missing?
Thanks in advance.
Regards,
Eric