• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Ruby on Rails question: yaml problem with scaffold generation

 
Ranch Hand
Posts: 511
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello there,

I have been reading the book, "Agile Web Development with Rails", by Dave Thomas.

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
 
Unnsse Khan
Ranch Hand
Posts: 511
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey! Discovered the problem... My gvim editor was placing extra spaces before the password string for the depot_test database in /config/database.yml.

Everything works now!

Ruby on Rails rocks! Truly XP-based programming, built-in!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic