Devise: error running rails generate devise:install

Created on 16 Jun 2013  路  10Comments  路  Source: heartcombo/devise

When running rails generate devise:install I get a below error message. Could you please advise me on where I may have gone wrong? The devise gem seems to have been installed correctly, although there is no devise.rb in initiliazers.

Thank you!

C:\Sites\code\omrails>rails generate devise:install
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/devise-2.2.4/lib/devise/rai
ls/routes.rb:448:in raise_no_devise_method_error!': Install does not respond to 'devise' method. This usually means you haven't loaded your ORM file or it's be ing 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) from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/devise-2.2.4/l ib/devise/rails/routes.rb:211:inblock in devise_for'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/devise-2.2.4/l
ib/devise/rails/routes.rb:207:in each' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/devise-2.2.4/l ib/devise/rails/routes.rb:207:indevise_for'
from C:/Sites/code/omrails/config/routes.rb:2:in block in <top (require d)>' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2 .13/lib/action_dispatch/routing/route_set.rb:289:ininstance_exec'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2
.13/lib/action_dispatch/routing/route_set.rb:289:in eval_block' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2 .13/lib/action_dispatch/routing/route_set.rb:267:indraw'
from C:/Sites/code/omrails/config/routes.rb:1:in <top (required)>' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 3.2.13/lib/active_support/dependencies.rb:245:inload'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.2.13/lib/active_support/dependencies.rb:245:in block in load' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 3.2.13/lib/active_support/dependencies.rb:236:inload_dependency'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.2.13/lib/active_support/dependencies.rb:245:in load' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 3/lib/rails/application/routes_reloader.rb:40:inblock in load_paths'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1
3/lib/rails/application/routes_reloader.rb:40:in each' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 3/lib/rails/application/routes_reloader.rb:40:inload_paths'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1
3/lib/rails/application/routes_reloader.rb:16:in reload!' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 3/lib/rails/application/routes_reloader.rb:26:inblock in updater'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.2.13/lib/active_support/file_update_checker.rb:78:in call' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 3.2.13/lib/active_support/file_update_checker.rb:78:inexecute'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1
3/lib/rails/application/routes_reloader.rb:27:in updater' from C:2:inrescue in execute_if_updated'
from C:in execute_if_updated' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 3/lib/rails/application/finisher.rb:66:inblock in module:Finisher'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1
3/lib/rails/initializable.rb:30:in instance_exec' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 3/lib/rails/initializable.rb:30:inrun'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1
3/lib/rails/initializable.rb:55:in block in run_initializers' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 3/lib/rails/initializable.rb:54:ineach'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1
3/lib/rails/initializable.rb:54:in run_initializers' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 3/lib/rails/application.rb:136:ininitialize!'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1
3/lib/rails/railtie/configurable.rb:30:in method_missing' from C:/Sites/code/omrails/config/environment.rb:5:in

    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-

3.2.13/lib/active_support/dependencies.rb:251:in require' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 3.2.13/lib/active_support/dependencies.rb:251:inblock in require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
3.2.13/lib/active_support/dependencies.rb:236:in load_dependency' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 3.2.13/lib/active_support/dependencies.rb:251:inrequire'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1
3/lib/rails/application.rb:103:in require_environment!' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 3/lib/rails/commands.rb:25:in from script/rails:6:in require' from script/rails:6:in

'

Most helpful comment

I think there is devise_for :installs in your route.rb file and you should comment it out. Then you should try to rerun rails generate devise:install .

All 10 comments

I think there is devise_for :installs in your route.rb file and you should comment it out. Then you should try to rerun rails generate devise:install .

Are your rubygems loaded in your PATH? try running as

bundle exec rails g devise:install

@yelinaung Thanks so much! I commented out 'devise_for :installs" as you suggested and the installation works now! Would you mind telling me what I might had done wrong?

@TomLondon I am glad it helps. I'd the similar issue. I looked around for the solution and solved as I said. Here's what I found via http://stackoverflow.com/questions/9247334/getting-error-from-devise-user-does-not-respond-to-devise-method-when-runnin#comment11660063_9247357

running rails g devise:install puts an initializer for devise in the file config/initializers/devise.rb. That's what loads all the devise methods so your application can use them. If you run rails g devise User before that initializer is in place, then your User model contains calls to methods that the application doesn't know about. So whenever you run any rails commands it'll fail because of... well, the error you were getting. It would also have failed if you tried to run rails server or rails c, or whatever.

Thanks everyone for helping this issue being solved!

The most common reason for this, is "gem 'devise'" is not in the gemfile.

@khopkins218 even though your comment was 4 years old now, it did save my life. :-) thank you so much

I had the exact same issue and it worked when I commented out the devise_for.

Thank You!!!

Thank you so much. Saved my morning. Commenting out 'devise_for :installs' worked.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ragesoss picture ragesoss  路  3Comments

edipox picture edipox  路  4Comments

mikeki picture mikeki  路  4Comments

Pedroknoll picture Pedroknoll  路  3Comments

afuno picture afuno  路  3Comments