how do I create a table for my model?

I'm not sure what is meant by "create a table for the model" because the database has a table...they mean a different table?

[thufir@localhost dummy]$   [thufir@localhost dummy]$   [thufir@localhost dummy]$ ruby script/generate scaffold dummy         exists app/controllers/         exists app/helpers/         exists app/views/dummies         exists app/views/layouts/         exists test/functional/     dependency model         exists app/models/         exists test/unit/         exists test/fixtures/      identical app/models/dummy.rb      identical test/unit/dummy_test.rb      identical test/fixtures/dummies.yml          error Before updating scaffolding from new DB schema, try creating a table for your model (Dummy)   [thufir@localhost dummy]$ ll   total 116   drwxrwxr-x 6 thufir thufir 4096 May 13 04:15 app   drwxrwxr-x 2 thufir thufir 4096 May 13 04:15 components   drwxrwxr-x 3 thufir thufir 4096 May 13 05:11 config   drwxrwxr-x 2 thufir thufir 4096 May 13 04:15 db   drwxrwxr-x 2 thufir thufir 4096 May 13 04:15 doc   drwxrwxr-x 3 thufir thufir 4096 May 13 04:15 lib   drwxrwxr-x 2 thufir thufir 4096 May 13 04:15 log   drwxrwxr-x 5 thufir thufir 4096 May 13 04:15 public   -rw-rw-r-- 1 thufir thufir 307 May 13 04:15 Rakefile   -rw-rw-r-- 1 thufir thufir 8001 May 13 04:15 README   drwxrwxr-x 4 thufir thufir 4096 May 13 04:15 script   drwxrwxr-x 7 thufir thufir 4096 May 13 04:15 test   drwxrwxr-x 6 thufir thufir 4096 May 13 04:15 tmp   drwxrwxr-x 3 thufir thufir 4096 May 13 04:15 vendor   [thufir@localhost dummy]$   [thufir@localhost dummy]$   [thufir@localhost dummy]$ cat config/database.yml   # MySQL (default setup). Versions 4.1 and 5.0 are recommended.

From your output it looks like you have a database named 'dummy' containing a single table named 'px_feeds'. The scaffold generator can automatically create a PxFeed model based on the px_feeds table, but you're (implicitly) telling it to look for a 'dummies' table to create a Dummy model and DummiesController controller ('dummy' -> 'dummies', assuming this falls under the general pluralization rules).

-faisal

Rails assumes, that the table for a model called "dummy" is called "dummies", the table for a "user" model would be "users" etc. - unless you've configured Rails differently. That's one of Rails' main priciples, convention over configuration. I'd recommend a book called "Agile web development with Rails" - the first part walks you through the development of a simple shop app, which will address 90% of the problems you'll come across eventually, the second is a great reference when you start building your own apps (and it also includes the basics of Ruby, so don't worry about that). It's definitely worth it - and look for the 2nd edition. http://pragmaticprogrammer.com/titles/rails

[...]

From your output it looks like you have a database named 'dummy'
containing a single table named 'px_feeds'. The scaffold generator
can automatically create a PxFeed model based on the px_feeds table,
but you're (implicitly) telling it to look for a 'dummies' table to
create a Dummy model and DummiesController controller ('dummy' ->
'dummies', assuming this falls under the general pluralization rules).

-faisal

Aha, thanks. Long term I'll have to muck with the the configuration because the feed-on-feeds database is setup how it's setup, ruby will have to work around it :frowning:

-Thufir

Rails assumes, that the table for a model called "dummy" is called "dummies", the table for a "user" model would be "users" etc. - unless you've configured Rails differently.

[...]

Have I not done so?

[thufir@localhost dummy]$ [thufir@localhost dummy]$ ruby script/generate scaffold dummy       exists app/controllers/       exists app/helpers/       exists app/views/dummies       exists app/views/layouts/       exists test/functional/   dependency model       exists app/models/       exists test/unit/       exists test/fixtures/    identical app/models/dummy.rb    identical test/unit/dummy_test.rb    identical test/fixtures/dummies.yml        error Before updating scaffolding from new DB schema, try creating a table for your model (Dummy) [thufir@localhost dummy]$ [thufir@localhost dummy]$ pwd /home/thufir/dummy [thufir@localhost dummy]$ ll total 116 drwxrwxr-x 6 thufir thufir 4096 May 13 04:15 app drwxrwxr-x 2 thufir thufir 4096 May 13 04:15 components drwxrwxr-x 3 thufir thufir 4096 May 13 05:11 config drwxrwxr-x 2 thufir thufir 4096 May 13 04:15 db drwxrwxr-x 2 thufir thufir 4096 May 13 04:15 doc drwxrwxr-x 3 thufir thufir 4096 May 13 04:15 lib drwxrwxr-x 2 thufir thufir 4096 May 13 04:15 log drwxrwxr-x 5 thufir thufir 4096 May 13 04:15 public -rw-rw-r-- 1 thufir thufir 307 May 13 04:15 Rakefile -rw-rw-r-- 1 thufir thufir 8001 May 13 04:15 README drwxrwxr-x 4 thufir thufir 4096 May 13 04:15 script drwxrwxr-x 7 thufir thufir 4096 May 13 04:15 test drwxrwxr-x 6 thufir thufir 4096 May 13 04:15 tmp drwxrwxr-x 3 thufir thufir 4096 May 13 04:15 vendor [thufir@localhost dummy]$ [thufir@localhost dummy]$ mysql -u feeds -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 32 to server version: 5.0.27

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

use dummy;

Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A

Database changed

It looks like your database is called "dummy",

> use dummy;

  but your YAML file (and Rails convention) has "dummy_development", etc.

development:   adapter: mysql   database: dummy_development

Is that your problem? (Sorry, didn't see or pay attention to your initial post)

-Rob

thanks, one step closer :slight_smile:

now I'm looking into how to display a "SELECT * FROM dummies" query.

[thufir@localhost dummy]$ [thufir@localhost dummy]$ [thufir@localhost dummy]$ pwd /home/thufir/dummy [thufir@localhost dummy]$ [thufir@localhost dummy]$ ll total 116 drwxrwxr-x 6 thufir thufir 4096 May 13 04:15 app drwxrwxr-x 2 thufir thufir 4096 May 13 04:15 components drwxrwxr-x 3 thufir thufir 4096 May 16 06:06 config drwxrwxr-x 2 thufir thufir 4096 May 13 04:15 db drwxrwxr-x 2 thufir thufir 4096 May 13 04:15 doc drwxrwxr-x 3 thufir thufir 4096 May 13 04:15 lib drwxrwxr-x 2 thufir thufir 4096 May 13 04:15 log drwxrwxr-x 5 thufir thufir 4096 May 13 04:15 public -rw-rw-r-- 1 thufir thufir 307 May 13 04:15 Rakefile -rw-rw-r-- 1 thufir thufir 8001 May 13 04:15 README drwxrwxr-x 4 thufir thufir 4096 May 13 04:15 script drwxrwxr-x 7 thufir thufir 4096 May 13 04:15 test drwxrwxr-x 6 thufir thufir 4096 May 13 04:15 tmp drwxrwxr-x 3 thufir thufir 4096 May 13 04:15 vendor [thufir@localhost dummy]$ [thufir@localhost dummy]$ cat config/database.yml # MySQL (default setup). Versions 4.1 and 5.0 are recommended.

[...]

This I'm unclear on. The database should be called dummy or dummy_development ? change the YAML to match the database or the database to match the YAML? If the mountain won't come to mohammed, then...

I was thinking that ruby would automagically figure out the *_development in keeping with its automagically figuring out dummy and its plural dummies.

-Thufir