簡體   English   中英

可安裝Rails的Engine + Devise

[英]Rails mountable Engine + Devise

我正在使用Devise(作為引擎)進行身份驗證應用程序。 我遵循了此鏈接中的步驟,一切正常,直到我收到命令

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

現在數據庫也成功遷移,因此我認為數據庫連接正常工作。 上面提到的命令是從引擎目錄運行的。 如果需要任何信息將其注釋掉,我將提供詳細信息。 謝謝

使用devise 3.2.x代替devise 3.3.x

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM