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?
–
Kind Regards,
Rajinder Y.
On Sun, Feb 28, 2010 at 2:09 PM, Rajinder Y. [email protected]
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 D. with Rails 3rd” by Dave T. et al.
Good look,
-Conrad
Conrad T. wrote:
do the following:
from “Agile Web D. with Rails 3rd” by Dave T. 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 D.
with Rails 3rd” soon =) but I’ll will check out the section now.
Conrad T. wrote:
object
Store:
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 Y.
On Sun, Feb 28, 2010 at 2:36 PM, Rajinder Y. [email protected]
wrote:
Rajinder, you can read the section on “Cart Creation”. Also, there’s
later
section(s) in the book that goes into greater detail.
Good luck,
-Conrad