Augury
Augury

Reputation: 15

Rails Console Error

I've been trying to get my rails stack set up for the longest time, and so far I've been able to get everything running, but I get this error when I try to run the rails console:

C:/Ruby192/lib/ruby/1.9.1/psych.rb:148:in `parse': couldn't parse YAML at line 8 column 0 (Psych::SyntaxError)
  from C:/Ruby192/lib/ruby/1.9.1/psych.rb:148:in `parse_stream'
  from C:/Ruby192/lib/ruby/1.9.1/psych.rb:119:in `parse'
  from C:/Ruby192/lib/ruby/1.9.1/psych.rb:106:in `load'
  from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5.rc1/lib/rails/application/configuration.rb:88:in `database_configuration'
  from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.5.rc1/lib/active_record/railtie.rb:58:in `block (2 levels) in <class:Railtie>'
  from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.5.rc1/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
  from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.5.rc1/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
  from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.5.rc1/lib/active_support/lazy_load_hooks.rb:43:in `block in run_load_hooks'
  from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.5.rc1/lib/active_support/lazy_load_hooks.rb:42:in `each'
  from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.5.rc1/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks'
  from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.5.rc1/lib/active_record/base.rb:1900:in `<top (required)>'
  from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.5.rc1/lib/active_record/railtie.rb:32:in `block in <class:Railtie>'
  from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5.rc1/lib/rails/railtie.rb:180:in `call'
  from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5.rc1/lib/rails/railtie.rb:180:in `each'
  from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5.rc1/lib/rails/railtie.rb:180:in `load_console'
  from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5.rc1/lib/rails/application.rb:154:in `block in load_console'
  from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5.rc1/lib/rails/application/railties.rb:11:in `each'
  from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5.rc1/lib/rails/application/railties.rb:11:in `all'
  from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5.rc1/lib/rails/application.rb:154:in `load_console'
  from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5.rc1/lib/rails/commands/console.rb:26:in `start'
  from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5.rc1/lib/rails/commands/console.rb:8:in `start'
  from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5.rc1/lib/rails/commands.rb:23:in `<top (required)>'
  from script/rails:6:in `require'
  from script/rails:6:in `<main>'

I saw various fixes online, but they didn't end up solving the problem. Just wondering if anyone else has this same issue or knows how to fix it. Thanks.

Database.yml:
# SQLite version 3.x
# gem install sqlite3
development:
  adapter: mysql
  database: shovell_development
  pool: 5
  timeout: 5000
    username: root
    password: randompassword12
    host: localhost

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  adapter: mysql
  database: shovell_test
  pool: 5
  timeout: 5000
    username: root
    password: randompassword12
    host: localhost

production:
  adapter: mysql
  database: shovell_production
  pool: 5
  timeout: 5000
    username: root
    password: randompassword12
    host: localhost

Upvotes: 0

Views: 1338

Answers (3)

Ashish
Ashish

Reputation: 5791

Just remove the spaces from left side of username, password and host to make it align and try.

Upvotes: 1

dnch
dnch

Reputation: 9605

The problem is with the formatting of your database.yml file. The lines under timeout: 5000 should not be indended, ie:

development:
  adapter: mysql
  database: shovell_development
  pool: 5
  timeout: 5000
  username: root
  password: randompassword12
  host: localhost

Upvotes: 4

Alex Wayne
Alex Wayne

Reputation: 187134

username, password and host are indented too much. They should be indented the same as the other parameters under each enviroment name.

Upvotes: 2

Related Questions