2

Based on stackoverflow question for overriding current_user of devise, I wrote something like this:

class ApplicationController < ActionController::Base
    alias_method :devise_current_user, :current_user
    def current_user
        if !devise_current_user.nil?
            return # my logic
        end
        return nil
    end
end

Two questions: 1. It throws an undefined method error where I define alias_method .... 2. In the devise_for method, will my overriden current_user will be passed or the devise's current_user?

Rajat
  • 1,766
  • 2
  • 21
  • 42
  • Could you please share the link to the question you followed – Baylor Rae' Sep 17 '12 at 18:55
  • Sure: http://stackoverflow.com/questions/12461347/cancanability-where-is-the-current-user-method-defined and http://stackoverflow.com/questions/10349606/where-to-override-current-user-helper-method-of-devise-gem – Rajat Sep 17 '12 at 18:57

0 Answers0