I’m still a bit confused about the issue of storing “complex” objects
in session state rather than storing simple objects.
It’s my understanding that everything is an object in Ruby. If my
understanding is correct, then storing a string or an integer in
session means storing an object.
It would seem then that the problem of storing objects in session is a
matter of how “complex” those objects are, and that problems may arise
due if much work is required by the runtime to unmarshal larger
amounts of structured data.
With this is mind, how “bad” would it be to store the following in
Struct.new(“User”, :name, :role).new(“jdoe”, “admin”)
I would prefer to keep the data pertaining to “user” (in this case)
encapsulated in a single struct and to store that struct in session.
Is this categorically a bad thing to do?