Calling ruby script/generate scaffold category dependency mo

Hi,

I’m trying to play around with the scaffolding(?) example that I found
in the 4 Days on Rails tutorial, and I tried running

ruby script/generate scaffold category dependency model

but rather than generating files that were made plural as the example
shows:

app/controllers/categories_controller.rb

scaffold created:

app/controllers/dependencies_controller.rb

So I changed the command to:

ruby script/generate scaffold category categories model

and that did create a categories_controller.rb which seem to match the
tutorial examples.

Is this a version problem that the author warned about at the beginning
of the tutorial? I’m using the latest.

But another question I have is, when these scaffold scripts are created
which controllers do I use for my rails project? The original
category_controller.rb or categories_controller.rb. Would the URL to
the project be ‘http://localhost:3000/category’ or
http://localhost:3000/categories’.

Grateful for any tips and thanks.

Todd

Hi,
In fact, when you want to use scaffold generator, you don’t need to
create controller and model separatly, scaffold does all this thing in
one command.
If you don’t want the controller’s name to be pluralized:
script/scaffold Page page

Then, your controller’s name is page and not pages.

2005/11/8, tmatsumoto:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Nov 8, 2005, at 2:15 AM, tmatsumoto wrote:

Is this a version problem that the author warned about at the
beginning of the tutorial? I’m using the latest.

Yes, it appears that the tutorial is for an older version of Rails.

Curt H.’ guide on O’Reilly is up to date as well as the Pragmatic
Programmers’ book Agile Web D. with Rails.

http://www.pragmaticprogrammer.com/titles/rails/

But another question I have is, when these scaffold scripts are
created which controllers do I use for my rails project? The
original category_controller.rb or categories_controller.rb. Would
the URL to the project be ‘http://localhost:3000/category’ or
http://localhost:3000/categories’.

Your URLs correspond to the literal controller name.

By default, your URLs are routed by :controller/:action/:id, so if
you have category/show/1 it will route to CategoryController, action
show, with params[:id] set to 1. Similarly, if you have categories/
edit/3 it will route to CategoriesController, action edit, with params
[:id] set to 3.

jeremy
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (Darwin)

iD8DBQFDcH6DAQHALep9HFYRApQTAKCOAz/ICPpZJeFTwxsKaZuYf9nT6wCfa8aF
/7F43armL+48jcs/xwVAAeA=
=QUjG
-----END PGP SIGNATURE-----