Hi
What are the repercussions of storing a model in the session with
respect to the relations being up to date and such? Is the information
actually serialized or is it loaded / unloaded in between actions?
(I would assume it’s being serialized but I would like to make sure).
Secondly, is this a good practice in Rails or should I be storing ID’s
instead and loading unloading from the DB myself?(It’s okay in other
technologies if you manage serialization well but Rails is still new to
me)
I have some comments on BOTH serialization and load/unload with respect
to overhead, excessive db connections, netork IO etc etc, but I’ll get
into that if it’s needed when people reply.
Thanks.
from personal experience they are serialized and do not work well when
being stored in the session. your best bet is to keep the id in the
session and query the db each time
On Sep 19, 10:37 pm, Jean N. [email protected]
Andrew B. wrote:
from personal experience they are serialized and do not work well when
being stored in the session. your best bet is to keep the id in the
session and query the db each time
On Sep 19, 10:37 pm, Jean N. [email protected]
Okay obviously this creates nice fresh data every action, but, there may
be times when I need it to be stale…
I also worry about the excessive queries but I can learn to get around
it, what really raises my eyebrow (You’re not te first person to tell me
models in session == no good) is how will Rails handle a decent caching
mechanism if I always am querying the db?
First thought for both the need for stale info AND caching is a Factory
Pattern who’s job is to handle the conversion (back and forth) of my
Model information and ‘flattening’ it into a non ActiveRecord normal
Class.
I welcome and encourage comments.
Thanks
John