This is exactly 3 minutes into the video rails_take2_with_sound.mov
from http://www.rubyonrails.org/screencasts.
I have just created the database and posts table. I'm on a Windows
box.
Let's say for a newbie this type of error is under-informed and a show
stopper.
C:\ruby\brablog>..\bin\ruby ./script/generate model Post
C:/ruby/lib/ruby/1.8/yaml.rb:133:in `load': syntax error on line 32,
col -1: `'
(ArgumentError)
from C:/ruby/lib/ruby/1.8/yaml.rb:133:in `load'
from C:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/
initializer.rb:523:in `database_configuration'
from C:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/
initializer.rb:228:in `initialize_database'
from C:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/
initializer.rb:88:in `process'
from C:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/
initializer.rb:43:in `send'
from C:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/
initializer.rb:43:in `run'
from ./script/../config/../config/environment.rb:13
from C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
27:in `gem_original_require'
from C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
27:in `require'
from C:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/
generate.rb:1
from C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
27:in `gem_original_require'
from C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
27:in `require'
from ./script/generate:3
My database.yml is as follows:
# MySQL (default setup). Versions 4.1 and 5.0 are recommended.
Hi,
Choosing another tutorial is one option.
However, no one in the Ruby community can tell me what the error is
that I'm running into?
C:\ruby\brablog>..\bin\ruby ./script/generate model Post
C:/ruby/lib/ruby/1.8/yaml.rb:133:in `load': syntax error on line 32,
col -1: `'
(ArgumentError)
from C:/ruby/lib/ruby/1.8/yaml.rb:133:in `load'
from C:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/
initializer.rb:523:in `database_configuration'
from C:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/
initializer.rb:228:in `initialize_database'
from C:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/
initializer.rb:88:in `process'
from C:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/
initializer.rb:43:in `send'
from C:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/
initializer.rb:43:in `run'
from ./script/../config/../config/environment.rb:13
from C:/ruby/lib/ruby/site_ruby/1.8/rubygems/
custom_require.rb:
27:in `gem_original_require'
from C:/ruby/lib/ruby/site_ruby/1.8/rubygems/
custom_require.rb:
27:in `require'
from C:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/
generate.rb:1
from C:/ruby/lib/ruby/site_ruby/1.8/rubygems/
custom_require.rb:
27:in `gem_original_require'
from C:/ruby/lib/ruby/site_ruby/1.8/rubygems/
custom_require.rb:
27:in `require'
from ./script/generate:3
Ok, so I figured this out myself.
It appears ruby files (in my case my database.yml) cannot deal with a
TAB CHARACTER ???
If this is defined with a tab in front of development I get the parse
error.
production:
development
If I change this to no tab (spaces), it will parse and complete.
WT*? Who writes a parser that deals with human edited files and
cannot deal with tabs ?
Please make the parser smart enough to handle this.
And if you can't parse a character please output the ASCII and/or
'\0x' values of the characters that messed up the parser
AND what the file was that was being parsed.
PLEASE
database.yml is a YAML file and not particular to Ruby (or Rails, for that matter). See the YAML spec.
http://www.yaml.org/
In particular, their FAQ:
http://www.yaml.org/faq.html
Michael Glaesemann
grzm seespotcode net