# Script/generate scaffold pluralizes class names

**URL:** <https://www.ruby-forum.com/t/script-generate-scaffold-pluralizes-class-names/62689>\
**Category:** Rails\
**Created:** [June 7, 2006, 11:40am UTC](https://www.ruby-forum.com/t/script-generate-scaffold-pluralizes-class-names/62689 "2006-06-07T11:40:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jfoxny](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a6a055/32.png) [@jfoxny](https://www.ruby-forum.com/u/jfoxny)\
**Post date:** [June 7, 2006, 11:40am UTC](https://www.ruby-forum.com/t/script-generate-scaffold-pluralizes-class-names/62689/1 "2006-06-07T11:40:38Z")

</div>

Hi everyone,

I’m a rails & ruby nuby, and this is my first post to the list.  
Here’s my environment in case it helps diagnose my problem:

Ruby version  
1.8.4 (powerpc-darwin8.6.0)  
RubyGems version  
0.8.11  
Rails version  
1.1.2  
Active Record version  
1.14.2  
Action Pack version  
1.12.1  
Action Web Service version  
1.1.2  
Action Mailer version  
1.2.1  
Active Support version  
1.3.1

I did “rails myapp” and inserted “scaffold :foo” into the  
controllers, which worked fine but I wanted to have the scaffold code  
generated so I could see it and tweak it. So I did a “script/generate  
scaffold foo” and it generated new views and controllers with  
scaffolding in them, but now the controllers and views are all  
pluralized: my user controller became users, my tag controller became  
tags, etc. So looking at my file tree I wound up with two files names  
tag\_controller.rb & tags\_controller.rb - inside the first line says  
“TagsController” not “TagController” like when rails does it. Is this  
a bug? Why would the generate script pluralize things just because I  
want the scaffolding code inserted?

Is this a problem- will I wind up with other problems because my  
controllers/views/who-knows-what-else are plural now? Every code  
example I’ve read shows the controllers all being in the singular.

Any advice is appreciated!

Thanks,  
-Jason

---

<div class="post-metadata">

**Author:** ![jfoxny](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a6a055/32.png) [@jfoxny](https://www.ruby-forum.com/u/jfoxny)\
**Post date:** [June 7, 2006, 3:35pm UTC](https://www.ruby-forum.com/t/script-generate-scaffold-pluralizes-class-names/62689/2 "2006-06-07T15:35:12Z")

</div>

You can control this behavior by changing your generate command by  
using the syntax

script/generate scaffold Model controller

e.g.,

script/generate scaffold Item item

script/generate scaffold Product admin

---

<div class="post-metadata">

**Author:** ![jfoxny](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a6a055/32.png) [@jfoxny](https://www.ruby-forum.com/u/jfoxny)\
**Post date:** [June 7, 2006, 1:14pm UTC](https://www.ruby-forum.com/t/script-generate-scaffold-pluralizes-class-names/62689/3 "2006-06-07T13:14:44Z")

</div>

Jason F. wrote:

> 1.1.2
> 
> want the scaffolding code inserted?
> 
> Is this a problem- will I wind up with other problems because my  
> controllers/views/who-knows-what-else are plural now? Every code  
> example I’ve read shows the controllers all being in the singular.
> 
> Any advice is appreciated!
> 
> Thanks,  
> -Jason

Hi Jason,

That is normal behaviour. When you “scaffold” an item, the URL will be  
singular. When you generate the scaffold code, it will be in the  
plural. In fact, you will find that both work fine. For example, you  
could do:  
[http://app/item](http://app/item)#this will use the default scaffold  
or  
[http://app/items](http://app/items) #this will use the generated code and changes made to  
the generated code will show here

Hope this helps. RoR has a seemingly esoteric naming convention, which  
makes life a lot easier when you get used to it 🙂  
Cheers  
Mohit.
