Forum: Ruby on Rails Help with creating Scaffold ...

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
untz (Guest)
on 2005-12-01 09:49
(Received via mailing list)
Hello there!

I am a Ruby on Rails newbie... Am currently reading the book, "Agile
Web D. with Rails", and am on page 57.

When I typed "ruby script/generate scaffold Product Admin", I got the
following error (Please note that this is the second time I ran
this command and that's why one will see the "identical" status marker):

Raven:/Developer/DevResources/Ruby/RailsApps/depot untz$ 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
#28000Access denied for user 'root'@'localhost' (using password: NO)
Raven:/Developer/DevResources/Ruby/RailsApps/depot untz$

I am using ruby 1.8.3 and rails 0.14.3 on Mac OS X Tiger...

Many, many thanks!

Kindest regards,

Unnsse
kevin.jackson (Guest)
on 2005-12-01 10:18
(Received via mailing list)
Unnsse Khan wrote:

> generate scaffold Product Admin
>    identical    test/fixtures/products.yml
> #28000Access denied for user 'root'@'localhost' (using password: NO)
> Raven:/Developer/DevResources/Ruby/RailsApps/depot untz$

You get this when MySQL needs a password to connect to the database.
Check your config/database.yml file and make sure you've put the correct
password in there

Kev
untz786 (Guest)
on 2005-12-02 00:28
(Received via mailing list)
Hello again,

When I checked my database.yml file and placed my user name and
password...

And this is the new error that I get:

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
17, col -2: `production: (ArgumentError)
   adapter: mysql
   database: depot_production
   socket: /tmp/mysql.sock
   username: untz
   password: wibble
'       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

Here's the contents of the database.yml file:

development:
   adapter: mysql
   database: depot_development
   socket: /tmp/mysql.sock
   username: untz
   password: shabu

# 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: shabu

production:
   adapter: mysql
   database: depot_production
   socket: /tmp/mysql.sock
   username: untz
   password: wibble

Kindest regards,

Unnsse
Bakki K. (Guest)
on 2005-12-15 06:44
untz786 wrote:
> Hello again,
>
> When I checked my database.yml file and placed my user name and
> password...
>
> And this is the new error that I get:
>
> 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
> 17, col -2: `production: (ArgumentError)
>    adapter: mysql
>    database: depot_production
>    socket: /tmp/mysql.sock
>    username: untz
>    password: wibble
...........................
> production:
>    adapter: mysql
>    database: depot_production
>    socket: /tmp/mysql.sock
>    username: untz
>    password: wibble

You have the same username with a different password for the production
db. Create another valid user for production with a different pwd. I
think it'll solve the problem.

bakki
This topic is locked and can not be replied to.