Forum: Ruby on Rails parse error in database.yml

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Andrew G. (Guest)
on 2006-01-08 23:14
(Received via mailing list)
Since upgrading to rails 1.0 I keep getting a parse error in
database.yml.

I have tried multiple configurations of both mysql and postgres and
continue getting this error message when trying to generate a model or
scaffold.

-Andrew
Joe Van D. (Guest)
on 2006-01-08 23:45
(Received via mailing list)
On 1/8/06, Andrew G. <removed_email_address@domain.invalid> wrote:
> Since upgrading to rails 1.0 I keep getting a parse error in database.yml.
>
> I have tried multiple configurations of both mysql and postgres and
> continue getting this error message when trying to generate a model or
> scaffold.

And we're supposed to magically know what the error is that you're
getting?
Andrew G. (Guest)
on 2006-01-09 04:25
(Received via mailing list)
ruby script/generate model page
/usr/local/lib/ruby/1.8/yaml.rb:119:in `load': parse error on line 6,
col -4: `test: (ArgumentError)
  adapter: postgresql
  database: musings-test
  username: andrew
  password: flubber

production:
  adapter: postgresql
  database: musings-production
  username: andrew
  password: flubber'  from /usr/local/lib/ruby/1.8/yaml.rb:119:in `load'
        from
/usr/local/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/initializer.rb:424:in
`database_configuration'
        from
/usr/local/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/initializer.rb:168:in
`initialize_database'
        from
/usr/local/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/initializer.rb:83:in
`process'
        from
/usr/local/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/initializer.rb:42:in
`send'
        from
/usr/local/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/initializer.rb:42:in
`run'
        from ./script/../config/../config/environment.rb:10
        from
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in
`require__'
        from
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in
`require'
        from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:214:in
`require'
        from
/usr/local/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/commands/generate.rb:1
        from
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in
`require__'
        from
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in
`require'
        from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:214:in
`require'
        from script/generate:3
Justin F. (Guest)
on 2006-01-09 09:15
(Received via mailing list)
Andrew G. wrote:
>   database: musings-production
>   username: andrew
>   password: flubber'  from /usr/local/lib/ruby/1.8/yaml.rb:119:in `load'

Shouldn't those be underscores? musings_test, etc.

Also be sure there are no tab characters in your YAML.

regards

   Justin
Joe Van D. (Guest)
on 2006-01-09 22:11
(Received via mailing list)
On 1/9/06, Andrew G. <removed_email_address@domain.invalid> wrote:
> ruby script/generate model page
> /usr/local/lib/ruby/1.8/yaml.rb:119:in `load': parse error on line 6,

So, what's on line 6 of your config/database.yml file?
Andrew G. (Guest)
on 2006-01-10 10:23
(Received via mailing list)
I figured it out. I had a "#" character in my password which was
causing the parse error. Putting quotes around the password fixed it.
I would guess that the # was being read as the start of a comment but
I'm not sure why this would cause a parse error rather than just
denying access.

But it works now and I am happy.

Thanks,
-Andrew
This topic is locked and can not be replied to.