Trying to reproduce "Creating a weblog in 15 minutes"


#1

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:indatabase_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:inprocess’
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:inrun’
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:inrequire’
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:inrequire’
from ./script/generate:3

My database.yml is as follows:

MySQL (default setup). Versions 4.1 and 5.0 are recommended.

Install the MySQL driver:

gem install mysql

On MacOS X:

gem install mysql – --include=/usr/local/lib

On Windows:

gem install mysql

Choose the win32 build.

Install MySQL and put its /bin directory on your path.

And be sure to use new-style password hashing:

http://dev.mysql.com/doc/refman/5.0/en/old-client.html

development:
adapter: mysql
database: blog_development
username: root
password: password
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: blog_test
username: root
password: password
host: localhost

production:
development


#2

We have some tutorials (screencasts plus written text) explaining the
whole thing. We use our IDE, Ruby In Steel in these. However, if you are
using some other IDE, you can still follow the essential details of our
tutorial, cutting and pasting the Ruby/RHTML code as you need it.

There’s an old tutorial here (with a PDF download of instructions plus a
screencast):
http://www.sapphiresteel.com/Create-a-Weblog-With-Ruby-In-Steel

That is an ‘exact’ copy of the DHH tutorial. The IDE used is a (now
quite old) beta version of Ruby In Steel Personal Edition.

We have a newer and slightly adapted Blog tutorial (with migrations)
here:

part one:
http://www.sapphiresteel.com/How-To-Create-a-Ruby-On-Rails-Blog
part two:
http://www.sapphiresteel.com/How-To-Create-A-Ruby-On-Rails-Blog,168

The IDE in this tutorial is Ruby In Steel Developer 1.1.

best wishes
Huw

SapphireSteel Software
http://www.sapphiresteel.com/


#3

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:indatabase_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:inprocess’
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:inrun’
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:inrequire’
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:inrequire’
from ./script/generate:3

On Jul 3, 4:22 pm, Huw C. <rails-mailing-l…@andreas-


#4

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


#5

On Jul 5, 2007, at 8:33 , bluejaguar wrote:

It appears ruby files (in my case my database.yml) cannot deal with a
TAB CHARACTER ???

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 G.
grzm seespotcode net