I am looking at implementing some form of anonymous user system in Rails. I need people to do something (creating records, looking at what they created, etc.), without actually creating an account. Once they create an account, everything remains without the risk of losing it by clearing cookies or something like that.
Right now, I think it's pretty simple. Have the is_anonymous field in the User model and use something like this to access the currently logged in user:
def find_user session[:user_id] ||= create_new_anonymous_user.id end
Assuming that the session is maintained for a reasonable period of time and the session cookie does not expire, this should ensure smooth operation.
However, there is this part of me that is convinced that I am missing something related to security. Has anyone done something like this before? Am I missing something super-obvious?
Thanks!
security ruby ruby-on-rails
Tim sullivan
source share