I have a model “Users” and am working with a Session.
Users, without being logged in, are allowed to modify a User.new object in the session, without actually saving the User.
I would like to enable the not-yet-logged-in user to view their Users#Show page.
What is the best way to do this?
Thanks!
In your controller, you could do something like this:
So you get the current_user if there is one, and if not, you read from the session.
Storing an entire model in the session usually sucks though. If you change the underlying class, then the object in the session won’t be unmarshalled correctly, so ensure you reset your session with
reset_sessionafter you make changes to your User class or else you’ll get lots of strange errors.