Closed dhirajbajaj closed 10 years ago
There is a logging_in_user
callback (replace user with whatever your devise model is called) that you can tap into to re-assign related items.
Eg.
class User < ActiveRecord::Base
devise :database_authenticatable
before_logging_in_user do
# run some queries to set user_id columns to current_user.id
end
end
I'm open to pull requests that (optionally) do some model introspection to automate this, but I haven't had that need myself.
I think this will work with unique lazy_id based on rand or timestamp: http://stackoverflow.com/questions/8267230/gradual-engagement-persistent-guest-user-with-devise
@cbeer Looks like that callback is defined in the controller, not model, right?
I need to persistently track Guest users to do activities like comments; vote etc. Until they sign up One way is to : I can create/sign in the guest user using current_or_guest_user helper method and change their email when they sign up with password and show all their past activities.
Is there any other quick method to do that. Or are you planning to add same.