Can I execute custom actions after successful sign in with Devise?

前端 未结 5 2396
春和景丽
春和景丽 2020-12-08 15:01

I have an app that has basic Devise authentication. After sign in, I would like to look up the user account (user belongs_to account, account has_many users), and store tha

5条回答
  •  孤城傲影
    2020-12-08 15:42

    In application controller, you can simply add an after action.

    app/controllers/users/application_controller.rb

    class ApplicationController < ActionController::Base
      after_action :do_something
    
      def do_something
        # do something
      end
    end
    

提交回复
热议问题