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. -- 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 -~----------~----~----~----~------~----~------~--~---
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 Nibee <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> 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. > -- > 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 -~----------~----~----~----~------~----~------~--~---
Andrew Bloom 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 Nibee <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>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 -- 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 -~----------~----~----~----~------~----~------~--~---