Conrad Taylor wrote:
On Sun, Feb 28, 2010 at 2:36 PM, Rajinder Yadav <devguy.ca <http://devguy.ca>@gmail.com <http://gmail.com>> wrote:

    Conrad Taylor wrote:

        On Sun, Feb 28, 2010 at 2:09 PM, Rajinder Yadav <devguy.ca
        <http://devguy.ca> <http://devguy.ca>@gmail.com
        <http://gmail.com> <http://gmail.com>> wrote:

           ok this is really basic rails question, but how do I keep an
        object
           alive between controller action? I thought I could create an
        object
           and it would remain alive, but I am guessing the controller
        object
           gets recreated each time?


        Rajinder, you can store the object in a session.  For example,
        you can do the following:

        Store:

        session[:object_to_persist] = an_object

        Retrieve:

        some_local_variable = session[:object_to_persist]

        For further information, I would recommend reading the relevant
        section from "Agile Web Development with Rails 3rd" by Dave
        Thomas et al.


    Hi Conrad,

    thanks I was not sure session object was the right way to do things.
    I've got 3 books on Rails and I'm hoping to get "Agile Web
    Development with Rails 3rd" soon =) but I'll will check out the
    section now.


Rajinder, you can read the section on "Cart Creation". Also, there's later section(s) in the book that goes into greater detail.

Conrad, thanks again =) it's working like a charm and I'll read the entire section on "Cart Creation" tonight!

Kind Regards,
Rajinder Yadav



Good luck,

-Conrad


        Good look,

        -Conrad
-- Kind Regards,
           Rajinder Yadav

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