I have the following scenario and am trying to find the best way to accomplish it. Model: I have an Order model which accepts a customers billing & shipping address, order info and order item details. Controller: I have a store_controller which currently has a checkout action and a save_order action. View: 1. I have one template / page (checkout.html.erb) with a form for the customer to enter their billing and shipping info. 2. I need another template / page which based on the customers country selection in the previous page displays the correct currency and calculates the correct VAT or Tax info. This will update and display the cart totals. The customer will also on this page enter in their credit card info and submit for order processing. Here''s where I have the question. As you can see I need to break up my checkout page into two pages. One for billing and shipping info, and one for the final checkout confirmation and the customer to enter their credit card info. After the credit card is authorized this would all get submitted to the Order model for validation and saving. I have done this plenty of times in the past but not in Rails and wanted to try and find a "rails way" to solve this. How would you tackle this problem? Thanks very much. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I would have an orderaddress object that you can split to shipping and billing address that belongs to your order model, like this: belongs_to :billing_address, :class_name => ''OrderAddress'', :foreign_key => ''billing_address_id'', :dependent => :destroy belongs_to :shipping_address, :class_name => ''OrderAddress'', :foreign_key => ''shipping_address_id'', :dependent => :destroy Validate and save this information before going to the cc page. And most likely you do not want to save the creditcard info anyways so it will be virtual attributes that you validate within the order model. Thats some information that might help... I''m kinda in the middle of spliting my own page so the next step someone else can answer :) --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks very much for your response. I''m going to look into doing this. On Oct 1, 11:09 am, Freddy Andersen <fre...-RCI/mp9mI1I6GGFevw1D/A@public.gmane.org> wrote:> I would have an orderaddress object that you can split to shipping and > billing address that belongs to your order model, like this: > > belongs_to :billing_address, :class_name => ''OrderAddress'', > :foreign_key => ''billing_address_id'', > :dependent => :destroy > belongs_to :shipping_address, :class_name => ''OrderAddress'', > :foreign_key => ''shipping_address_id'', > :dependent => :destroy > > Validate and save this information before going to the cc page. And > most likely you do not want to save the creditcard info anyways so it > will be virtual attributes that you validate within the order model. > > Thats some information that might help... I''m kinda in the middle of > spliting my own page so the next step someone else can answer :)--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---