ruby on rails - Alias/Override helpers loaded using ActiveSupport.on_load -
devise provide several helper methods such current_user . uses activesupport's on_load lazily load these helpers controllers. however means when first starts rails, attempt alias these helper methods not work correctly. example: # in applicationcontroller alias_method :devise_current_user, :current_user def current_user user = devise_current_user if !user && !devise_controller? foo end return user end this cause "method not found error" when rails first initialized. can start rails first, add these code, work (correctly aliasing , overriding method). how aliasing/overriding these on_load helpers?