Discussion Forums
- Topic List
- Most Recent Posts
- Sign In for more options
I've a User model with username, email and password fields in one of my customized e-commerce site. Now, I want to have a Customer resource with some additional customer-specific infos like shipping address, billing, etc.. so that if the customer revisits the site, his stored Customer infos would be populated in the Checkout action. The User model will have the login credentials but it's not necessary that he will have the Customer model will have the related data. After googling around, I found "this blog post":http://afreshcup.com/2008/10/19/coming-in-rails-22-delegate-prefixes/ which depicts the scenario similar that I'm looking for. But I couldn't figure out how can I accomplish this in my controller and views?? Since the comment is closed on that post, I'm here to get some help. Thanks
In this case you should consider the shipping / billing address as resources too, and related with customer's info. Routing looks like this:
map.resources :customers, :has_many => [:shipping_address, :billing_address]
Following "this link":http://api.rubyonrails.org/classes/ActionController/Resources.html#M000354 for more details.
