本文介绍了从设计中获取错误“用户不响应”设计“方法”当运行“rails generate devise:install”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我从设计中得到错误运行rails generate devise:install时,用户不会回应devise方法。想想如何解决?
I'm getting error from devise "User does not respond to 'devise' method" when running "rails generate devise:install". Ideas re how to resolve?
其实也是在尝试运行rails generate devise:install时得到这个错误。我刚才注意到。
In fact also get this error when trying to run "rails generate devise:install" I just noted.
注意:
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'
和
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)
推荐答案
听起来你已经在你的用户模型中调用了设计方法。也许你已经运行了 rails g devise User
?
注释出来,并在您的路线文件中注释出 devise_for:users
行,如果在那里。
Comment that out, and comment out the devise_for :users
line in your routes file, if that is in there.
这篇关于从设计中获取错误“用户不响应”设计“方法”当运行“rails generate devise:install”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!