On 2 August 2010 22:48, pipplo
<joe.koston-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Hey Everyone
>
> I''m new to RoR and this group so please let me know if
I''m not being
> descriptive enough, or if I''m asking questions when I should RTFM.
>
> I have a basic understanding of RoR, but I''m kinda missing the
next
> step for a web application I have in mind.
>
> I want to create an order form, where the user clicks on say New Form,
> and then enter name and address and other basic info.
>
> Then, using some AJAX he can add multiple "items" to the order.
Now I
> think I understand how to do this if I want to create an Order, and
> then each time the user adds a new item that item gets put into the
> database, etc.
>
> What I can''t figure out how to do is have the user fill out a
form,
> and then submit it at the end to make sure nothing gets put into the
> db until the form is complete. I don''t want the user changing
their
> mind before clicking submit and being left with stale data in the db.
> And I would also like to do it as a transaction so that if the
> database fails I can roll back data.
>
> Now I''m sure this is possible...but I just don''t know
where I''m
> supposed to store the data until final submission time in Ruby. In
> PHP I would just use some session data to store data as the user is
> going through. Is that the "Ruby Way" too? Am I missing
something?
Using the session is a reasonable way to go. I wonder whether you
need to store anything in the db till all is complete, you could just
keep it in the session. Then you don''t have to worry about clearing
it up if the operation is never completed.
Colin
>
> Any explanations, or pointers to some good reading are welcomed!
>
> Thanks!
>
> Joe
>
> --
> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
>
>
--
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.