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?