def require_authentication!(options = {})
      options.reverse_merge!(as: :user)
      return if self.class.allow_actions == :all
      return if self.class.allow_actions.present? && params[:action].to_sym.in?(self.class.allow_actions)

      unless signed_in?(options)
        session["#{options[:as]}_return_to"] = request.url if request.get?
        redirect_to new_session_path_for(options[:as])
      end
    end
def require_authentication!(options = {})
      options.reverse_merge!(as: :user)
      return if self.class.allow_actions == :all
      return if self.class.allow_actions.present? && params[:action].to_sym.in?(self.class.allow_actions)

      unless signed_in?(options)
        session["#{options[:as]}_return_to"] = request.url if request.get?
        redirect_to new_session_path_for(options[:as])
      end
    end
ex.)
 before_action -> { require_authentication! as: :user }, only: :secret_action