× {{alert.msg}} Never ask again
Get notified about new tutorials RECEIVE NEW TUTORIALS

ActiveAdmin and Devise when using a model named Admin

Elad Meidar
Sep 24, 2014
<p>When using both Devise and ActiveAdmin, having a model named "Admin" causes the following error when trying to load the app:</p><pre><code class="language-bash">.../gems/devise-3.3.0/lib/devise/rails/routes.rb:493:in `raise_no_devise_method_error!': Admin does not respond to 'devise' method. This usually means you haven't loaded your ORM file or it's being loaded too late. To fix it, be sure to require 'devise/orm/YOUR_ORM' inside 'config/initializers/devise.rb' or before your application definition in 'config/application.rb' (RuntimeError)</code></pre><p>This is being caused by the <code>register_module</code> method in <a href="https://github.com/gregbell/active_admin/blob/master/lib/active_admin/namespace.rb#L164">lib/active_admin/namespace.rb</a>, which creates a root namespace to hold Active Admin's classes in order to prevent polluting the global namespace when running as a backend website. The default configuration uses the <code>/admin</code> URL namespace, with the <code>Admin</code> ruby module namespacing Active Admin's constituents.</p><p>Save for redesigning how AA does namespacing, there's nothing we can do to fix this. For now at least, you should consider <code>Admin</code> to be reserved and unavailable for use in your application.</p>
comments powered by Disqus