Hi, Background: I have customer''s details in the customers table (for example email, address...) Whenthat customer proceeds to checkout (which is controlled by the cart_controller not the customer-controller), the checkout form fields display empty. For example: <p><label for="order_ship_to_address">Address</label></p> <p><%= text_field :order, :ship_to_address %></p> How can I show the customer''s details in the form fields? but still use the form input to process the order? TIA, Elle --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Take a look at form_for. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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''m not sure what you mean. I had a look at form_for and it looks the same, besides the way to lay out your fields. It still sends me to the same action. What if I want details from one model/table to appear in the fields but the final input to go to another model? The relationships are already in place. I''m just not sure how the checkout form can display custotmer''s details (if they exist), so the customer doesn''t have to re-type them all the time. I''m probably missing something. Can form_for do that? Elle On Oct 27, 9:30 am, Gerjan Stokkink <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Take a look at form_for. > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 2007-10-26 22:50:47 -0700, elle <waznelle-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> said:> > What if I want details from one model/table to appear in the fields > but the final input to go to another model? > The relationships are already in place. I''m just not sure how the > checkout form can display custotmer''s details (if they exist), so the > customer doesn''t have to re-type them all the time.I think what you''re looking for is text_field_tag: text_field is tied to a model attribute and uses only its actual value. text_field_tag lets you set up your own field and load your own value. For example: <%= text_field_tag ''order[ship_to_address]'', @order.ship_to_address || @customer.address %> This will preload the field with the given value from @customer. The || expression is for loading it from an existing order instance if the customer has already filled this out. --Andrew Vit --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---