我正在使用Devise(作为引擎)进行身份验证应用。我按照 this link中的步骤完成所有事情,直到我到达命令
rails generate devise MODEL
在此命令之后的上述链接中显示一些错误
invoke active_record
create db/migrate/20140901111733_devise_create_fd_users.rb
/Users/user/.rvm/gems/ruby-1.9.3-p547/gems/activerecord-4.1.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:541:in `retrieve_connection': ActiveRecord::ConnectionNotEstablished (ActiveRecord::ConnectionNotEstablished)
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/activerecord-4.1.5/lib/active_record/connection_handling.rb:113:in `retrieve_connection'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/activerecord-4.1.5/lib/active_record/connection_handling.rb:87:in `connection'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/devise-3.3.0/lib/generators/active_record/devise_generator.rb:86:in `postgresql?'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/devise-3.3.0/lib/generators/active_record/devise_generator.rb:78:in `inet?'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/devise-3.3.0/lib/generators/active_record/devise_generator.rb:74:in `ip_column'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/devise-3.3.0/lib/generators/active_record/devise_generator.rb:56:in `migration_data'
from (erb):4:in `migration_template'
from /Users/user/.rvm/rubies/ruby-1.9.3-p547/lib/ruby/1.9.1/erb.rb:838:in `eval'
from /Users/user/.rvm/rubies/ruby-1.9.3-p547/lib/ruby/1.9.1/erb.rb:838:in `result'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/railties-4.1.5/lib/rails/generators/migration.rb:64:in `block in migration_template'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/actions/create_file.rb:53:in `call'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/actions/create_file.rb:53:in `render'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/actions/create_file.rb:62:in `block (2 levels) in invoke!'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/actions/create_file.rb:62:in `open'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/actions/create_file.rb:62:in `block in invoke!'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/actions/empty_directory.rb:116:in `call'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/actions/empty_directory.rb:116:in `invoke_with_conflict_check'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/actions/create_file.rb:60:in `invoke!'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/actions.rb:94:in `action'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/railties-4.1.5/lib/rails/generators/migration.rb:34:in `create_migration'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/railties-4.1.5/lib/rails/generators/migration.rb:63:in `migration_template'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/devise-3.3.0/lib/generators/active_record/devise_generator.rb:16:in `copy_devise_migration'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `block in invoke_all'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `each'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `map'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `invoke_all'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/group.rb:232:in `dispatch'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/invocation.rb:115:in `invoke'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/group.rb:277:in `block in _invoke_for_class_method'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/shell.rb:68:in `with_padding'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/group.rb:266:in `_invoke_for_class_method'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/group.rb:149:in `_invoke_from_option_orm'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `block in invoke_all'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `each'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `map'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `invoke_all'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/group.rb:232:in `dispatch'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/railties-4.1.5/lib/rails/generators.rb:157:in `invoke'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/railties-4.1.5/lib/rails/commands/generate.rb:11:in `<top (required)>'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:247:in `require'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:247:in `block in require'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:232:in `load_dependency'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:247:in `require'
from /Users/user/.rvm/gems/ruby-1.9.3-p547/gems/railties-4.1.5/lib/rails/engine/commands.rb:19:in `<top (required)>'
from bin/rails:12:in `require'
from bin/rails:12:in `<main>'
我认为数据库连接没有正确建立所以我使用命令
进行了测试rails generate model Test name:string email:string
它正常工作,然后我给了
rake db:migrate
现在数据库也成功迁移,所以我认为数据库连接正常工作。上面提到的命令是从Engine的目录运行的。如果需要任何信息,请注明我将提供详细信息。感谢
答案 0 :(得分:0)
使用设计3.2.x而不是设计3.3.x