ruby on rails - Update Attributes After Sign In Devise -
i using devise in rails 3 app.
i update attributes of user on successful sign in.
i doing following way:
i added following code application_controller.rb
def after_sign_in_path_for(user) @user = current_user @user.status = "online" @user.save root_path end
is possible have different method doing , not using method used defining after_sign_in_path ?
thanks in advance!
you can hooks warden.
##config/initializers/devise.rb warden::manager.after_authentication |user,auth,opts| user.update_attribute(:currently_signed_in, true) end warden::manager.before_logout |user,auth,opts| user.update_attribute(:currently_signed_in, false) end
Comments
Post a Comment