Benjamin
Benjamin

Reputation: 561

Rails problem creating a new scaffold with mysql

Im trying to set up a new scaffold with rails3, and mysql5.5. I got an error about couldn't parse YAML or something so I followed guidance on this question but now I get this error and I have no idea why.

C:\projectname>rails generate scaffold Website name:string
invoke  active_record
path/to/lib/ruby/1.9.1/syck.rb:135:in `load': syntax error on line 15, col 2: host:     localhost' (ArgumentError)
    from path/to/lib/ruby/1.9.1/syck.rb:135:in `load'
    from path/to/railties-3.0.9/lib/rails/application/configuration.rb:88:in `database_configuration'
    from path/to/activerecord-3.0.9/lib/active_record/railtie.rb:58:in `block (2 levels) in<class:Railtie>'
    from path/to/activesupport-3.0.9/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
    from path/to/activesupport-3.0.9/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
    from path/to/activesupport-3.0.9/lib/active_support/lazy_load_hooks.rb:43:in `block in run_load_hooks'
    from path/to/activesupport-3.0.9/lib/active_support/lazy_load_hooks.rb:42:in `each'
    from path/to/activesupport-3.0.9/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks'
    from path/to/activerecord-3.0.9/lib/active_record/base.rb:1909:in `<top (required)>'
    from path/to/railties-3.0.9/lib/rails/generators/named_base.rb:97:in `pluralize_table_names?'
    from path/to/railties-3.0.9/lib/rails/generators/named_base.rb:44:in `table_name'
    from path/to/activerecord-3.0.9/lib/rails/generators/active_record/model/model_generator.rb:16:in `create_migration_file'
    from path/to/thor-0.14.6/lib/thor/task.rb:22:in `run'
    from path/to/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
    from path/to/thor-0.14.6/lib/thor/invocation.rb:124:in `block in invoke_all'
    from path/to/thor-0.14.6/lib/thor/invocation.rb:124:in `each'
    from path/to/thor-0.14.6/lib/thor/invocation.rb:124:in `map'
    from path/to/thor-0.14.6/lib/thor/invocation.rb:124:in `invoke_all'
    from path/to/thor-0.14.6/lib/thor/group.rb:226:in `dispatch'
    from path/to/thor-0.14.6/lib/thor/invocation.rb:109:in `invoke'
    from path/to/thor-0.14.6/lib/thor/group.rb:269:in `block in _invoke_for_class_method'
    from path/to/thor-0.14.6/lib/thor/shell.rb:74:in `with_padding'
    from path/to/thor-0.14.6/lib/thor/group.rb:258:in `_invoke_for_class_method'
    from path/to/thor-0.14.6/lib/thor/group.rb:150:in `_invoke_from_option_orm'
    from path/to/thor-0.14.6/lib/thor/task.rb:22:in `run'
    from path/to/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
    from path/to/thor-0.14.6/lib/thor/invocation.rb:124:in `block in invoke_all'
    from path/to/thor-0.14.6/lib/thor/invocation.rb:124:in `each'
    from path/to/thor-0.14.6/lib/thor/invocation.rb:124:in `map'
    from path/to/thor-0.14.6/lib/thor/invocation.rb:124:in `invoke_all'
    from path/to/thor-0.14.6/lib/thor/group.rb:226:in `dispatch'
    from path/to/thor-0.14.6/lib/thor/base.rb:389:in `start'
    from path/to/railties-3.0.9/lib/rails/generators.rb:163:in `invoke'
    from path/to/railties-3.0.9/lib/rails/commands/generate.rb:10:in `<top (required)>'
    from path/to/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `require'
    from path/to/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `block in require'
    from path/to/activesupport-3.0.9/lib/active_support/dependencies.rb:225:in `block in load_dependency'
    from path/to/activesupport-3.0.9/lib/active_support/dependencies.rb:596:in `new_constants_in'
    from path/to/activesupport-3.0.9/lib/active_support/dependencies.rb:225:in `load_dependency'
    from path/to/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in `require'
    from path/to/railties-3.0.9/lib/rails/commands.rb:17:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

Any help solving this would be appreciated.

Upvotes: 0

Views: 480

Answers (1)

mkk
mkk

Reputation: 7693

have you read the error message? it looks like you are missing colon, coma or something like this in your database configuration file. it is near the line with "host: localhost"

Upvotes: 2

Related Questions