Railtie initializer preventing devise from loading #13

cbascom opened this Issue Jun 30, 2012 · 3 comments

2 participants


While developing a new gem that is an extension for devise, I added this gem for testing my generator. The tests themselves work great, but when I went back to run my test rails app for the integration tests, the rails app wouldn't load due to the following error from devise:

lib/devise/rails/routes.rb:443: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)

After some searching and the realization that this has worked fine before, I removed the ammeter gem from my gemspec and everything works fine again (other than the tests of course). I played around some more after adding the gem back to my gemspec and I have found that the problem seems to have something to do with the order that the initializers are being run. If I remove the :after=> :disable_dependency_loading from the ammeter initializer, everything seems to load fine in the rails app and tests also work fine.

Not sure if this is an acceptable fix for the problem or if you have any other ideas?


As far as I can tell this does not break anything - ammeter's specs and features still pass. I will try to verify against some projects I find in the wild and if all looks good push a new release.

Thanks for finding the issue and your suggestion of how to fix!


Version 0.2.7 released with this fix


Thanks, loaded and running now and it all looks good. Thanks for the quick response and release!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment