Hello. I'm new to RoR. I run RoR on my Slackware. I follow the depot example and have a problem when run the script: root@localhost:~/work/depot# ruby script/generate scaffold Admin Product /usr/lib/ruby/1.8/yaml.rb:133:in `load': syntax error on line 5, col 2: ` socket:/var/run/mysql/mysql.sock' (ArgumentError) from /usr/lib/ruby/1.8/yaml.rb:133:in `load' from /usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/initializer.rb:424:in `database_configuration' from /usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/initializer.rb:168:in `initialize_database' from /usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/initializer.rb:83:in `process' from /usr/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/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require' from /usr/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:214:in `require' from /usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/commands/generate.rb:1 from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require' from /usr/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:214:in `require' from script/generate:3 I have check file socket /var/run/mysql/mysql.sock, it exists. I don't know how to fix. what do i have to do to make it work ? Thanks
on 2006-01-29 21:49
on 2006-01-30 03:43
You have an error in the syntax of your database.yml file. You must have only spaces and no tabs are allowed in yaml. Go through your whole databse.yml file again and make sure there are no extra spaces or tabs at all and you should be ok. Cheers- -Ezra On Jan 29, 2006, at 11:49 AM, thong le duc wrote: > from > from ./script/../config/../config/environment.rb:10 > from > > -- > > _______________________________________________ > Rails mailing list > email@example.com > http://lists.rubyonrails.org/mailman/listinfo/rails > -Ezra Z. WebMaster Yakima Herald-Republic Newspaper firstname.lastname@example.org 509-577-7732
on 2006-01-30 08:54
Thanks, Ezra. It's worked. Actually, i have checked database.yml several times before post the question but i didn't notice tabs, didn't know that tabs aren't allowed.
on 2006-01-30 11:10
Yes! the whole tab thing in the YAML should be better documented. NO TABS IN YAMLS, ONLY SPACES. I just added this gotcha to http://wiki.rubyonrails.org/rails/pages/Gotcha Hopefully it will not strike someone again (wishful thinking)! Maybe the next best thing to do is to run a script before starting the server to check for dumb things like that... Thanks! Dominique joe ld wrote: > > Thanks, Ezra. It's worked. > Actually, i have checked database.yml several times before post the > question but i didn't notice tabs, didn't know that tabs aren't allowed.
on 2006-01-30 11:53
Dominique P. wrote: > Yes! the whole tab thing in the YAML should be better documented. Have you *seen* the yaml.org faq? :-)
on 2006-02-03 17:12
On Jan 30, 2006, at 3:54 AM, Alex Y. wrote: >> Yes! the whole tab thing in the YAML should be better documented. > Have you *seen* the yaml.org faq? :-) I believe the point is that 99.9999% of people using database.yml will not have. It happens often enough that perhaps the first line of the generated database.yml file for a new project should say # IF YOU SEE STRANGE PROBLEMS WHEN STARTING YOUR APP, CHECK FOR TABS IN THIS FILE
on 2006-02-03 20:28
Yeah Dave... I asked you what would cause a syntax error in a yaml file after your rails talk at a NFJS and you said you had no idea! ;-) Sorry, couldn't resist... Really though, a default comment in the yaml generator would save lots of angst and frustration (that syntax error so took the wind out of my sails that I blew off rails for a couple weeks). Could be even simpler than Dave's idea: "NOTE: YAML DOES NOT ALLOW TABS". b PS: It was a really good presentation though Dave....