# Yaml Error When Trying to Generate Scaffold

**URL:** <https://www.ruby-forum.com/t/yaml-error-when-trying-to-generate-scaffold/49277>\
**Category:** Rails\
**Created:** [December 2, 2005, 1:25am UTC](https://www.ruby-forum.com/t/yaml-error-when-trying-to-generate-scaffold/49277 "2005-12-02T01:25:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![untz786](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/bc8723/32.png) [@untz786](https://www.ruby-forum.com/u/untz786)\
**Post date:** [December 2, 2005, 1:25am UTC](https://www.ruby-forum.com/t/yaml-error-when-trying-to-generate-scaffold/49277/1 "2005-12-02T01:25:39Z")

</div>

Hello there,

I am a Ruby on Rails newbie, and have been reading the book, “Agile  
Web D. with Rails”, by Dave T…

Seem to be stuck on page 57, when trying to invoke “ruby script/  
generate scaffold Product Admin”…

My depot/config/database.yml file’s contents are:

development:  
adapter: mysql  
database: depot\_development  
socket: /tmp/mysql.sock  
username: untz  
password: paintball

# 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: depot\_test  
socket: /tmp/mysql.sock  
username: untz  
password: paintball

production:  
adapter: mysql  
database: depot\_production  
socket: /tmp/mysql.sock  
username: untz  
password: paintball

When I created these tables using MySQL 5, I issued the following in  
the MySQL Command Line Monitor:

grant all on depot\_development.\* to ‘untz’@‘localhost’ identified by  
‘paintball’;  
grant all on depot\_test.\* to ‘untz’@‘localhost’ identified by  
‘paintball’;  
grant all on depot\_production.\* to ‘untz’@‘localhost’ identified by  
‘paintball’;

When I tried to generate a scaffold, this is the error I received:

Raven:/Developer/DevResources/Ruby/RailsApps/depot untz$ ruby script/  
generate scaffold Product Admin  
/usr/local/lib/ruby/1.8/yaml.rb:133:in `load': syntax error on line 19, col -2:`production: (ArgumentError)  
adapter: mysql  
database: depot\_production  
socket: /tmp/mysql.sock  
username: untz  
password: paintball  
’ from /usr/local/lib/ruby/1.8/yaml.rb:133:in `load' from /usr/local/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/ initializer.rb:419:in`database\_configuration’  
from /usr/local/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/  
initializer.rb:163:in `initialize_database' from /usr/local/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/ initializer.rb:80:in`process’  
from /usr/local/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/  
initializer.rb:40:in `run' from ./config/environment.rb:10 from /usr/local/lib/ruby/site_ruby/1.8/rubygems/ custom_require.rb:21:in`require’  
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.3/  
lib/active\_support/dependencies.rb:214:in `require' from /usr/local/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/ commands/generate.rb:1 from /usr/local/lib/ruby/site_ruby/1.8/rubygems/ custom_require.rb:21:in`require’  
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.3/  
lib/active\_support/dependencies.rb:214:in `require’  
from script/generate:3

I am using ruby 1.8.3 (2005-09-21) [powerpc-darwin8.2.0] on OS X  
Tiger and Rails 0.14.3…

Is the Ruby 1.8.3’s yaml corrupt?

Please help! I am at this point, stuck… I really want to learn  
“Ruby on Rails”, so any  
tips, suggestions, and hints would be greatly appreciated.

Is there a setting in Rails where I change a configuration to point  
to the prospective Ruby 1.8.3 on my local machine?

Do I need to re-install Ruby 1.8.2?

Many, many thanks!

-Unnsse

---

<div class="post-metadata">

**Author:** ![untz786](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/bc8723/32.png) [@untz786](https://www.ruby-forum.com/u/untz786)\
**Post date:** [December 2, 2005, 1:41am UTC](https://www.ruby-forum.com/t/yaml-error-when-trying-to-generate-scaffold/49277/2 "2005-12-02T01:41:48Z")

</div>

On Thu, Dec 01, 2005, untz wrote:

> /usr/local/lib/ruby/1.8/yaml.rb:133:in `load': syntax error on line 19, col -2:`production: (ArgumentError)

The error that you’re seeing often indicates a whitespace problem in the  
YAML. Tabs are illegal in YAML so make sure that all of the whitespace  
in your file truly are spaces and not tabs.

If that doesn’t work, there may be something else going on, but that’s a  
good place to start.

Ben

---

<div class="post-metadata">

**Author:** ![untz786](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/bc8723/32.png) [@untz786](https://www.ruby-forum.com/u/untz786)\
**Post date:** [December 2, 2005, 1:45am UTC](https://www.ruby-forum.com/t/yaml-error-when-trying-to-generate-scaffold/49277/3 "2005-12-02T01:45:50Z")

</div>

On Thu, Dec 01, 2005, untz wrote:

> # 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: depot\_test  
> socket: /tmp/mysql.sock  
> username: untz  
> password: paintball

On a second glance, it also might be those extra spaces between  
‘password:’ and ‘paintball’. Make sure that’s not a tab and that  
there’s only one space.

Ben

---

<div class="post-metadata">

**Author:** ![untz786](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/bc8723/32.png) [@untz786](https://www.ruby-forum.com/u/untz786)\
**Post date:** [December 2, 2005, 9:24am UTC](https://www.ruby-forum.com/t/yaml-error-when-trying-to-generate-scaffold/49277/4 "2005-12-02T09:24:41Z")

</div>

Ok, that’s a good observation… On gvim, it doesn’t show the tab and  
using pico, it does show the spaces…

When I fixed it and re ran the attempt to generate a scaffold, this  
is the new error I got:

ruby script/generate scaffold Product Admin  
exists app/controllers/  
exists app/helpers/  
exists app/views/admin  
exists test/functional/  
dependency model  
exists app/models/  
exists test/unit/  
exists test/fixtures/  
identical app/models/product.rb  
identical test/unit/product\_test.rb  
identical test/fixtures/products.yml  
create app/views/admin/\_form.rhtml  
Permission denied - ./app/views/admin/\_form.rhtml

Any suggestions?

Many, many thanks!

-Unnsse
