views:

810

answers:

2

I had this error when I do rake in the app directory, looks like YAML was failed to load. Can anybody help? Thanks

C:\Development\RUBY\laibe\ilr>rake --trace
(in C:/Development/RUBY/laibe/ilr)
** Invoke default (first_time)
** Invoke spec (first_time)
** Invoke db:test:prepare (first_time)
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
syntax error on line 26, col -1: `'
C:/Ruby/lib/ruby/1.8/yaml.rb:133:in `load'
C:/Ruby/lib/ruby/1.8/yaml.rb:133:in `load'
C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:880:in `database_configuration'
C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:416:in `initialize_database'
C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:141:in `process'
C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:113:in `send'
C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:113:in `run'
C:/Development/RUBY/laibe/ilr/config/environment.rb:12
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `requi
A: 

Looks like database.yml in the config folder is messed up.

Line 880 tries to load up that file:

YAML::load(ERB.new(IO.read(database_configuration_file)).result

# elsewhere
def default_database_configuration_file
  File.join(root_path, 'config', 'database.yml')
end
Sam Saffron
+2  A: 

If you want an answer, you must provide the relevant information. The error message says very clearly what is wrong: there is an error in line 26 of your database.yml. But since you haven't told us, what line 26 actually is, there is no way to answer your question.

Jörg W Mittag
It is the problem caused by database.yml thanks.
Shuoling Liu