In my ecommerce app I have customer model which has address  
attributes. The order model has foreign key to customers table.

There are several ways to do it. I let the screens drive the design.  
Pick the one that makes sense in your app.

Http://www.rubyplus.org
Free Ruby & Rails screencasts


On Sep 19, 2008, at 11:38 PM, emarthinsen  
<[EMAIL PROTECTED]> wrote:

>
> 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
> >

--~--~---------~--~----~------------~-------~--~----~
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