Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ruby on Rail using Agile Web Dev. book

Status
Not open for further replies.

RichardIII

Programmer
Jul 13, 2006
7
US
Hi All,

I tried to develop my own Rails app following the book "Agile Web Development with Rails" in a generalway, but got stuck. So I opted to try to follow the book faithfully to
see if I could get its example working.

I'm stuck on the command:
[snip]\work\depot>ruby script/generate scaffold Product Admin

It seems to work well for 10 lines or so but then complains:
#28000Access denied for user 'root'@'localhost' (using password: NO)

I assume the generator is using the database.yml parameters from the
development section,
which are:
development:
adapter: mysql
database: depot_development
username: root
password:xxxxxx

I confirmed that the generator was using this section by changing all
three usernames. The name in this section popped up in the error
message.

I think the error message means the generator wasn't passing along any
password because some other setting somewhere indicates that it need
not do so in this environment. Does this ring a bell with anyone?

I found one entry on the web claiming that this error message no longer
appeared after the user issued grant commands. Earlier in this
session, I had issued:

mysql> grant all on depot_development.* to 'root'@'localhost';
Query OK, 0 rows affected (0.03 sec)

mysql> grant all on depot_test.* to 'root'@'localhost';
Query OK, 0 rows affected (0.01 sec)

mysql> grant all on depot_production.* to 'root'@'localhost';
Query OK, 0 rows affected (0.00 sec)

Any ideas?

Thanks in advance,
Richard
 
The YAML standard indicates that the tags and the date must be separated by a colon and a space ': '. In your password field, you only have a colon.

Hope this helps.

-
 
Hi Azimuth,

> Hope this helps.

It sure did!!!! Thanks, a lot. You've kept me from tearing out all my hair! But I'm not out of danger yet. Now I got the message:

error Before updating scaffolding from new DB schema, try creating a table for your model (Product)

But I do have a products table in the development database (actually in all three databases) which the textbook says is what the "scaffold" generator will look for to support an Admin application for a Product. The command is:

[snip]\work\depot>ruby script/generate scaffold Product Admin

Any additional ideas?

Thanks again,
Richard
 
Hi Azimuth,

Thanks again for your contined help on this problem. Below is the schema within the code scope. A follow-up message will tell you the work-around I found. I'd still like to have a "real" solution.

Regards,
Richard

Code:
Show database scheme
mysql> show databases;
+---------------------------+
| Database                  |
+---------------------------+
| information_schema        |
| depot_development         |
| depot_production          |
| depot_test                |
| mysql                     |
| people                    |
| pmtallocmodel_development |
| pmtallocmodel_production  |
| pmtallocmodel_test        |
| todo                      |
+---------------------------+
10 rows in set (0.00 sec)

mysql> use depot_development;
Database changed

mysql> show tables;
+-----------------------------+
| Tables_in_depot_development |
+-----------------------------+
| products                    |
+-----------------------------+
1 row in set (0.00 sec)

mysql> mysql> select * from products;
+----+----------------------------------+-------------------------------------------------------------------------------
-----------------------+-----------+-------+
| id | title                            | description
                       | image_url | price |
+----+----------------------------------+-------------------------------------------------------------------------------
-----------------------+-----------+-------+
|  1 | Agile Web Development with Rails | A great tutorial! Your really wouldn't want to miss it. And the 2nd edition pr
omises to be a killer! |           | 50.00 |
+----+----------------------------------+-------------------------------------------------------------------------------
-----------------------+-----------+-------+
1 row in set (0.00 sec)

mysql>
 
Azimuth: Below is the generic message I posted on a couple of other news groups/lists:

Hi All,

Problem finally solved!

The original question was:
* Ran:
Code:
[snip]\work\depot>ruby script/generate scaffold Product Admin
* Got:
Code:
#28000Access denied for user 'root'@'localhost' (using password: NO)

One person observed that I failed to leave a space after the colon in config\database.yml's line:
Code:
password:xxxxxx

After I corrected that, I got:
error Before updating scaffolding from new DB schema, try creating a table for your model (Product)

I Googled this message and found I had to add
Code:
indentified by 'password'
to my grant statements ("password" is of course the actual password for the user identified in the grant statement.

Problem solved. Thanks one and all for helping me overcome this hurdle.

Regards,
Richard
 
Azimuth,

BTW, the data in the products table was inserted by the generated Rails "Depot" application, i.e. I entered the data in the app and the app populated the table. But I guess you surmised that.

Regards,
Richard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top