2016-05-06 15 views
0

Ruby on Railsの使い方を学んでいます。 前回私はユーザーの足場を作ろうとしました。Ruby on rails active support

rails generate scaffold user first_name:string last_name:string 

何らかの理由で動作しません。 私は最初に1つのメッセージを得てから、数秒後にかなり大きなメッセージを得ました。

まずエラーメッセージ:

C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/activesupport-4.0.2/lib/active_support/values/time_zone.rb:282: 
warning: circular argument reference - now invoke active_record 

2番目のメッセージ:

C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/activerecord-4.0.2/lib/active_record/connection_adapters/connection_specification.rb:58:in rescue in resolve_hash_connection: Specified 'mysql2' for database adapter, but the gem is not loaded. Add gem 'mysql2' to your Gemfile. (Gem::LoadError) 
    from C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/activerecord-4.0.2/lib/active_record/connection_adapters/connection_specification.rb:55:in `resolve_hash_connection' 
    from C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/activerecord-4.0.2/lib/active_record/connection_adapters/connection_specification.rb:46:in `resolve_string_connection' 
    from C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/activerecord-4.0.2/lib/active_record/connection_adapters/connection_specification.rb:30:in `spec' 
    from C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/activerecord-4.0.2/lib/active_record/connection_handling.rb:39:in `establish_connection' 
    from C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/activerecord-4.0.2/lib/active_record/railtie.rb:176:inblock (2 levels) in `class:Railtie' 
    from C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval' 
    from C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook' 
    from C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:45:in block in `run_load_hooks' 
    from C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:44:in `each' 
    from C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks' 
    from C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/activerecord-4.0.2/lib/active_record/base.rb:322:in `module:ActiveRecord' 
    from C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/activerecord-4.0.2/lib/active_record/base.rb:22:in `<top (required)>' 
    from C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require' 
    from C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in block in `require' 
    from C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency' 
    from C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require' 
    from C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/railties-4.0.2/lib/rails/generators/named_base.rb:172:in `pluralize_table_names?' 
    from C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/railties-4.0.2/lib/rails/generators/named_base.rb:112:in `table_name' 
    from C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/activerecord-4.0.2/lib/rails/generators/active_record/model/model_generator.rb:18:in `create_migration_file' 
    from C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run' 
    from C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command' 
    from C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in block in `invoke_all' 
    from C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `each' 
    from C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `map' 
    from C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `invoke_all' 
    from C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/group.rb:232:in `dispatch' 
    from C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/invocation.rb:115:in `invoke' 
    from C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/group.rb:277:in block in `_invoke_for_class_method' 
    from C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/shell.rb:68:in `with_padding' 
    from C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/group.rb:266:in `_invoke_for_class_method' 
    from C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/group.rb:133:in `_invoke_from_option_orm' 
    from C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run' 
    from C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command' 
    from C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `block in invoke_all' 
    from C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `each' 
    from C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `map' 
    from C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `invoke_all' 
    from C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/group.rb:232:in `dispatch' 
    from C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start' 
    from C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/railties-4.0.2/lib/rails/generators.rb:156:in `invoke' 
    from C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/railties-4.0.2/lib/rails/commands/generate.rb:11:in `' 
    from C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require' 
    from C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in block in `require' 
    from C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency' 
    from C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require' 
    from C:/row/Ruby23/lib/ruby/gems/2.3.0/gems/railties-4.0.2/lib/rails/commands.rb:48:in `<top (required)>' 
    from bin/rails:4:in `require' 
    from bin/rails:4:in `'' 
  • Railsのバージョン:4.0.2
  • Rubyのバージョン:2.3.0p0
+0

'しかし、宝石はロードされていません。あなたのGemfileに 'mysql2'を追加してください。 (Gem :: LoadError) 'から' mysql2' gemを 'Gemfile'に追加して' bundle install'しましたか? –

答えて

0

てみてください。 mysql2 gを追加するあなたのGemfileに入力して、bundle installコマンドを実行します。私はこれがうまくいくと思います。

+0

@Holgerに感謝します –