Plural and Unknown Controllers

Hello all,


So basically, do i only have to use plurals for the table names, and can
therefore delete any other plural controllers/models/anything else, or
do I need both?

Thanks, and I hope this makes some kind of sense.

Rails will let you do anything, but the convention is this given "foo"

SQL Table: foos
Controller: app/controllers/foo_controller.rb (class FooController)
Model: app/controllers/foo_model.rb (class Foo)
Views: app/views/foo

Take a look at the output of the following commands:

./script/generate controller
./script/generate model

These will setup the necessary stub files for you to fill out (and set the right plurization for you)

So you could do say...

./script/generate controller foo
./script/generate model foo

and you'd end up with the filenames I mention above.


Alright...a couple of points.

1. The scaffold command creates model, view and controller files, and
it likes plural for the controller and view names. That is why you have
duplicates. You made your own controller with the singular name, and
scaffold made the plural one. You can go back and delete the singular

So the quickest way to a running app is:

  a. rails airbus
  b. configure the database.yaml file
  c. ruby script/generate scaffold aircraft
  d. ruby script/generate scaffold user
  e. ruby script/server

2. The WebBrick server is just meant for testing one application at a
time. You will never have two apps at localhost:3000. But can have
multiple instances of Webrick running on different ports. eg. one on
localhost:3000 and one at localhost:3001.