I'm getting error from devise "User does not respond to 'devise' method" when running "rails generate devise:install". Ideas re how to resolve?
In fact also get this error when trying to run "rails generate devise:install" I just noted.
Notes:
Gregs-MacBook-Pro:testapp greg$ rails generate devise:install
/Library/Ruby/Gems/1.8/gems/devise-2.0.1/lib/devise/rails/routes.rb:406:in `raise_no_devise_method_error!': User 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)
from /Library/Ruby/Gems/1.8/gems/devise-2.0.1/lib/devise/rails/routes.rb:207:in `devise_for'
from /Library/Ruby/Gems/1.8/gems/devise-2.0.1/lib/devise/rails/routes.rb:203:in `each'
from /Library/Ruby/Gems/1.8/gems/devise-2.0.1/lib/devise/rails/routes.rb:203:in `devise_for'
from /Users/greg/source_rails/testapp/config/routes.rb:2
from /Library/Ruby/Gems/1.8/gems/actionpack-3.2.1/lib/action_dispatch/routing/route_set.rb:272:in `instance_exec'
from /Library/Ruby/Gems/1.8/gems/actionpack-3.2.1/lib/action_dispatch/routing/route_set.rb:272:in `eval_block'
from /Library/Ruby/Gems/1.8/gems/actionpack-3.2.1/lib/action_dispatch/routing/route_set.rb:249:in `draw'
and
Gregs-MacBook-Pro:testapp greg$ ruby -v
**ruby 1.8.7** (2010-01-10 patchlevel 249) [universal-darwin11.0]
Gregs-MacBook-Pro:testapp greg$ rails -v
**Rails 3.2.1**
Gregs-MacBook-Pro:testapp greg$ gem list
*** LOCAL GEMS ***
actionmailer (3.2.1)
actionpack (3.2.1)
activemodel (3.2.1)
activerecord (3.2.1)
activeresource (3.2.1)
activesupport (3.2.1)
addressable (2.2.6)
arel (3.0.0)
bcrypt-ruby (3.0.1)
builder (3.0.0)
bundler (1.0.22)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.2.0)
devise (2.0.1)
erubis (2.7.0)
execjs (1.3.0)
faraday (0.7.6)
hike (1.2.1)
i18n (0.6.0)
journey (1.0.1)
jquery-rails (2.0.0)
json (1.6.5)
mail (2.4.1)
mime-types (1.17.2)
multi_json (1.0.4)
multipart-post (1.1.4)
mysql (2.8.1)
mysql2 (0.3.11)
oauth (0.4.5)
oauth-plugin (0.4.0.rc2)
oauth2 (0.5.2)
orm_adapter (0.0.6)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.1)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.2.1)
railties (3.2.1)
rake (0.9.2.2)
rdoc (3.12)
rubygems-update (1.8.15)
sass (3.1.15, 3.1.14)
sass-rails (3.2.4)
sprockets (2.1.2)
sqlite3 (1.3.5)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.31)
uglifier (1.2.3)
warden (1.1.0)
It sounds like you already have the devise method being called in your User model. Perhaps you already ran rails g devise User
?
Comment that out, and comment out the devise_for :users
line in your routes file, if that is in there.
Completing a tutorial for rails & these answers didn't work for me, but after some searching found a solution. Hope this helps anyone else who's new and running into this issue.
devise_for :installs
(put a hash tag in front)rails generate devise:install
Now Devise should install properly & subsequent errors should be gone.
Source
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With