ruby gem devise无法生成初始化程序

时间:2014-10-19 22:50:51

标签: ruby-on-rails ruby devise

我按照https://github.com/plataformatec/devise上的步骤安装设备 在bundle install之后 我尝试使用以下命令将初始化程序添加到我的app配置中     rails generate devise:install

但是,我一直收到这个错误:

  

未定义的方法`设计' for User(call' User.connection'建立连接):Class(NoMethodError)

堆栈追踪:

/Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/activerecord-4.0.10/lib/active_record/dynamic_matchers.rb:22:in `method_missing': undefined method `devise' for User (call 'User.connection' to establish a connection):Class (NoMethodError)
from /Users/MyUsername/Documents/AppDev/Pinteresting/app/models/user.rb:4:in `<class:User>'
from /Users/MyUsername/Documents/AppDev/Pinteresting/app/models/user.rb:1:in `<top (required)>'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/activesupport-4.0.10/lib/active_support/dependencies.rb:424:in `load'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/activesupport-4.0.10/lib/active_support/dependencies.rb:424:in `block in load_file'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/activesupport-4.0.10/lib/active_support/dependencies.rb:616:in `new_constants_in'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/activesupport-4.0.10/lib/active_support/dependencies.rb:423:in `load_file'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/activesupport-4.0.10/lib/active_support/dependencies.rb:324:in `require_or_load'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/activesupport-4.0.10/lib/active_support/dependencies.rb:463:in `load_missing_constant'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/activesupport-4.0.10/lib/active_support/dependencies.rb:184:in `const_missing'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/activesupport-4.0.10/lib/active_support/inflector/methods.rb:226:in `const_get'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/activesupport-4.0.10/lib/active_support/inflector/methods.rb:226:in `block in constantize'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/activesupport-4.0.10/lib/active_support/inflector/methods.rb:224:in `each'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/activesupport-4.0.10/lib/active_support/inflector/methods.rb:224:in `inject'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/activesupport-4.0.10/lib/active_support/inflector/methods.rb:224:in `constantize'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/activesupport-4.0.10/lib/active_support/dependencies.rb:535:in `get'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/activesupport-4.0.10/lib/active_support/dependencies.rb:566:in `constantize'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/devise-3.4.0/lib/devise.rb:302:in `get'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/devise-3.4.0/lib/devise/mapping.rb:80:in `to'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/devise-3.4.0/lib/devise/mapping.rb:75:in `modules'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/devise-3.4.0/lib/devise/mapping.rb:92:in `routes'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/devise-3.4.0/lib/devise/mapping.rb:159:in `default_used_route'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/devise-3.4.0/lib/devise/mapping.rb:69:in `initialize'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/devise-3.4.0/lib/devise.rb:336:in `new'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/devise-3.4.0/lib/devise.rb:336:in `add_mapping'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/devise-3.4.0/lib/devise/rails/routes.rb:224:in `block in devise_for'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/devise-3.4.0/lib/devise/rails/routes.rb:223:in `each'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/devise-3.4.0/lib/devise/rails/routes.rb:223:in `devise_for'
from /Users/MyUsername/Documents/AppDev/Pinteresting/config/routes.rb:2:in `block in <top (required)>'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/actionpack-4.0.10/lib/action_dispatch/routing/route_set.rb:337:in `instance_exec'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/actionpack-4.0.10/lib/action_dispatch/routing/route_set.rb:337:in `eval_block'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/actionpack-4.0.10/lib/action_dispatch/routing/route_set.rb:315:in `draw'
from /Users/MyUsername/Documents/AppDev/Pinteresting/config/routes.rb:1:in `<top (required)>'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/activesupport-4.0.10/lib/active_support/dependencies.rb:223:in `load'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/activesupport-4.0.10/lib/active_support/dependencies.rb:223:in `block in load'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/activesupport-4.0.10/lib/active_support/dependencies.rb:214:in `load_dependency'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/activesupport-4.0.10/lib/active_support/dependencies.rb:223:in `load'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/railties-4.0.10/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/railties-4.0.10/lib/rails/application/routes_reloader.rb:40:in `each'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/railties-4.0.10/lib/rails/application/routes_reloader.rb:40:in `load_paths'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/railties-4.0.10/lib/rails/application/routes_reloader.rb:16:in `reload!'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/railties-4.0.10/lib/rails/application/routes_reloader.rb:26:in `block in updater'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/activesupport-4.0.10/lib/active_support/file_update_checker.rb:75:in `call'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/activesupport-4.0.10/lib/active_support/file_update_checker.rb:75:in `execute'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/railties-4.0.10/lib/rails/application/routes_reloader.rb:27:in `updater'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/railties-4.0.10/lib/rails/application/routes_reloader.rb:6:in `execute_if_updated'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/railties-4.0.10/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/railties-4.0.10/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/railties-4.0.10/lib/rails/initializable.rb:30:in `run'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/railties-4.0.10/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/MyUsername/.rvm/rubies/ruby-2.0.0-p576/lib/ruby/2.0.0/tsort.rb:150:in `block in tsort_each'
from /Users/MyUsername/.rvm/rubies/ruby-2.0.0-p576/lib/ruby/2.0.0/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
from /Users/MyUsername/.rvm/rubies/ruby-2.0.0-p576/lib/ruby/2.0.0/tsort.rb:219:in `each_strongly_connected_component_from'
from /Users/MyUsername/.rvm/rubies/ruby-2.0.0-p576/lib/ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component'
from /Users/MyUsername/.rvm/rubies/ruby-2.0.0-p576/lib/ruby/2.0.0/tsort.rb:180:in `each'
from /Users/MyUsername/.rvm/rubies/ruby-2.0.0-p576/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component'
from /Users/MyUsername/.rvm/rubies/ruby-2.0.0-p576/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/railties-4.0.10/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/railties-4.0.10/lib/rails/application.rb:215:in `initialize!'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/railties-4.0.10/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /Users/MyUsername/Documents/AppDev/Pinteresting/config/environment.rb:5:in `<top (required)>'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/activesupport-4.0.10/lib/active_support/dependencies.rb:229:in `require'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/activesupport-4.0.10/lib/active_support/dependencies.rb:229:in `block in require'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/activesupport-4.0.10/lib/active_support/dependencies.rb:214:in `load_dependency'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/activesupport-4.0.10/lib/active_support/dependencies.rb:229:in `require'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/railties-4.0.10/lib/rails/application.rb:189:in `require_environment!'
from /Users/MyUsername/.rvm/gems/ruby-2.0.0-p576/gems/railties-4.0.10/lib/rails/commands.rb:44:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'

1 个答案:

答案 0 :(得分:0)

好的,我发现了问题。我想是因为我以前安装过设计并尝试重新安装新版本。但是,设计会自动为应用程序创建一些模型。我删除了那些创建的文件夹/文件并重新运行rails generate devise:intall并且它有效。