title: Override DeviseController base class - Rails 4, Devise 3
body: <p>I am trying to override the Devise method <a href="https://github.com/plataformatec/devise/blob/master/app/controllers/devise_controller.rb#L145"><code>set_flash_message</code></a>. Devise documentation covers how to <a href="https://github.com/plataformatec/devise#configuring-controllers">override controllers for the various submodules</a>. </p>
  
  <p>However this particular method is located within <a href="https://github.com/plataformatec/devise/blob/master/app/controllers/devise_controller.rb"><code>DeviseController</code></a>, the <strong>parent</strong> class of all the modules. </p>
  
  <p>The documentation (both wiki and inline) says nothing about how to achieve this, so I'm not sure how best to proceed. I believe the best approach would be to simply re-open the class and modify the method as needed, and I placed a file in <code>/lib</code> to that effect. However it appears that is getting loaded prior to Devise, resulting in error spew.</p>
  
  <pre><code>NameError in Devise::RegistrationsController#new
  undefined local variable or method `require_no_authentication' for #&lt;Devise::RegistrationsController&gt;
  </code></pre>
  
  <p>The complex parent definition for <code>DeviseController</code> may also be having an net negative effect:</p>
  
  <pre><code>class DeviseController &lt; Devise.parent_controller.constantize
  </code></pre>
  
  <p>Thoughts?</p>