Have you created a schema file from an existing database? If you run the command
rake db:schema:dump
and then recreate your scaffold, this should fix the problem.
Alternatively, you can check out the Dr Nic Magic Model generator . This will create models for all of your existing tables and try to guess the relationship. This probably won't work if your table name is not clear with rails.
UPDATE
Usually I don’t use the default sketch, but I tested it myself, and it seems that if you skip the migration and do not go through any pairs of column names / types, the scaffold generator will not create anything in the template to display the columns.
Here you have two options:
- Go into the column name pairs and also skip the migration or
- Ryan Bates Nifty Scaffold, , --skip-migration