Forum: Ruby on Rails Calling ruby script/generate scaffold category dependency mo

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
9054a70a5ebc5824bc2a0b5465e7b342?d=identicon&s=25 tmatsumoto (Guest)
on 2005-11-13 15:56
(Received via mailing list)
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
24d2f8804e6bb4b7ea6bd11e0a586470?d=identicon&s=25 jeremy (Guest)
on 2005-11-13 15:56
(Received via mailing list)
-----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 Hibbs' guide on O'Reilly is up to date as well as the Pragmatic
Programmers' book _Agile Web Development with Rails_.

http://www.onlamp.com/pub/a/onlamp/2005/01/20/rails.html
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-----
D707194949c58eb4076f040adf116508?d=identicon&s=25 bruno.celeste (Guest)
on 2005-11-13 15:56
(Received via mailing list)
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:
This topic is locked and can not be replied to.