pass an object or an id??

hi,

Can you point me to the article or which book you have read that discourages in storing objects in session

Thanks

Hi James,

james_027 wrote:

Can you point me to the article or which book you have read that discourages in storing objects in session

"Agile Web Development with Rails", p. 314 "You probably don't want to store massive objects in session data -- put them in the database and reference them from the session."

The key here is to understand that if, for example, you have an object that 'has many' other objects, when you store the parent object in the session, all the children get stored too.

hth, Bill

I see you point bill, what if the object doesn't have child objects? Is there a way to tell rails that by default the child object will not be retrieve until needed?

will it be much more efficient to store the id of the object in the session and perform a lot of find operation (sql query)? how do we evaluate the two solutions?

thanks

There's also the staleness issue. Loading from db on each request ensures that you're working with current data.

Isak