title: Alias/Override helpers loaded using ActiveSupport.on_load
body: <p>Devise provide several helper methods such as <code>current_user</code>. It <a href="https://github.com/plataformatec/devise/blob/master/lib/devise/controllers/helpers.rb#L64" rel="nofollow">uses ActiveSupport's <code>on_load</code></a> to lazily load these helpers into the controllers.</p>
  
  <p>However this means that when I first starts Rails, my attempt to alias these helper methods will not work correctly. For example:</p>
  
  <pre><code># in my ApplicationController
  alias_method :devise_current_user, :current_user
  def current_user
    user = devise_current_user
    if !user &amp;&amp; !devise_controller?
      foo
    end
    return user
  end
  </code></pre>
  
  <p>This would cause "method not found error" when Rails is first initialized. I can start Rails first, then add these code, then it would work (correctly aliasing and overriding the method).</p>
  
  <p>How to properly do my aliasing/overriding for these <code>on_load</code> helpers?</p>