PodParley PodParley

#13 Dangers of Model in Session

Be careful when storing a model in a session. It will behave differently than you expect and can easily get out of sync with the database. Instead ...

An episode of the RailsCasts (Mobile) podcast, hosted by Ryan Bates, titled "#13 Dangers of Model in Session" was published on April 2, 2007 and runs 5 minutes.

April 2, 2007 ·5m · RailsCasts (Mobile)

0:00 / 0:00

Be careful when storing a model in a session. It will behave differently than you expect and can easily get out of sync with the database. Instead of storing the model directly in the session, store the id to the model and use that to fetch it from the database.

Be careful when storing a model in a session. It will behave differently than you expect and can easily get out of sync with the database. Instead of storing the model directly in the session, store the id to the model and use that to fetch it from the database.
URL copied to clipboard!