# Calling ruby script/generate scaffold category dependency mo

**URL:** <https://www.ruby-forum.com/t/calling-ruby-script-generate-scaffold-category-dependency-mo/47751>\
**Category:** Rails\
**Created:** [November 13, 2005, 3:56pm UTC](https://www.ruby-forum.com/t/calling-ruby-script-generate-scaffold-category-dependency-mo/47751 "2005-11-13T15:56:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tmatsumoto](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e47774/32.png) [@tmatsumoto](https://www.ruby-forum.com/u/tmatsumoto)\
**Post date:** [November 13, 2005, 3:56pm UTC](https://www.ruby-forum.com/t/calling-ruby-script-generate-scaffold-category-dependency-mo/47751/1 "2005-11-13T15:56:49Z")

</div>

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](http://localhost:3000/category)’ or  
‘[http://localhost:3000/categories](http://localhost:3000/categories)’.

Grateful for any tips and thanks.

Todd

---

<div class="post-metadata">

**Author:** ![tmatsumoto](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e47774/32.png) [@tmatsumoto](https://www.ruby-forum.com/u/tmatsumoto)\
**Post date:** [November 13, 2005, 3:56pm UTC](https://www.ruby-forum.com/t/calling-ruby-script-generate-scaffold-category-dependency-mo/47751/2 "2005-11-13T15:56:50Z")

</div>

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:

---

<div class="post-metadata">

**Author:** ![tmatsumoto](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e47774/32.png) [@tmatsumoto](https://www.ruby-forum.com/u/tmatsumoto)\
**Post date:** [November 13, 2005, 3:56pm UTC](https://www.ruby-forum.com/t/calling-ruby-script-generate-scaffold-category-dependency-mo/47751/3 "2005-11-13T15:56:49Z")

</div>

-----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_.

> **[Radar - O’Reilly](https://www.oreilly.com/radar/)**
>
> Now, next, and beyond: Tracking need-to-know trends at the intersection of business and technology

[http://www.pragmaticprogrammer.com/titles/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](http://localhost:3000/category)’ or  
> ‘[http://localhost:3000/categories](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-----
