# Confused with naming conventions

**URL:** <https://www.ruby-forum.com/t/confused-with-naming-conventions/156149>\
**Category:** Rails\
**Created:** [December 21, 2008, 6:15pm UTC](https://www.ruby-forum.com/t/confused-with-naming-conventions/156149 "2008-12-21T18:15:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![cojones](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/9f8e36/32.png) [@cojones](https://www.ruby-forum.com/u/cojones)\
**Post date:** [December 21, 2008, 6:15pm UTC](https://www.ruby-forum.com/t/confused-with-naming-conventions/156149/1 "2008-12-21T18:15:25Z")

</div>

Hey,

I’m currently reading “Agile Web D.” and doing the tutorial  
(Depot). It says that the naming conventions are that the Controller  
needs to be singular (even though I found other naming conventions on  
the net, anybody knows the official naming conventions?) therefore I  
have a UserController. When I try to test the controller I get this  
error:  
NameError: uninitialized constant UsersController  
right here:  
assert\_redirected\_to user\_path

Why does it want a UsersController? I thought singular is the way to go?  
Confused.

---

<div class="post-metadata">

**Author:** ![cojones](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/9f8e36/32.png) [@cojones](https://www.ruby-forum.com/u/cojones)\
**Post date:** [December 21, 2008, 8:51pm UTC](https://www.ruby-forum.com/t/confused-with-naming-conventions/156149/2 "2008-12-21T20:51:12Z")

</div>

I think it is models are singular  
eg  
User model

…and controllers are plural:  
users controller

Are you sure you read it right?

DAZ

On Dec 21, 5:15 pm, Heinz S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![cojones](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/9f8e36/32.png) [@cojones](https://www.ruby-forum.com/u/cojones)\
**Post date:** [December 22, 2008, 3:06am UTC](https://www.ruby-forum.com/t/confused-with-naming-conventions/156149/3 "2008-12-22T03:06:52Z")

</div>

DAZ wrote:

> I think it is models are singular  
> eg  
> User model
> 
> …and controllers are plural:  
> users controller
> 
> Are you sure you read it right?
> 
> DAZ
> 
> On Dec 21, 5:15ï¿½pm, Heinz S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

Yep, pretty sure:  
“Rails assumes the class is called StoreController and that itâ€™s in a  
file  
named store\_controller.rb in the app/controllers directory.”

So 100% plural?

---

<div class="post-metadata">

**Author:** ![cojones](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/9f8e36/32.png) [@cojones](https://www.ruby-forum.com/u/cojones)\
**Post date:** [December 22, 2008, 3:13am UTC](https://www.ruby-forum.com/t/confused-with-naming-conventions/156149/4 "2008-12-22T03:13:50Z")

</div>

## Some resources you’ll want singular controllers for, like session management. Others you’ll want plural controllers for, like forums, topics, posts and users. Think about how many items you’re dealing with at a time and then let that dictate how your controllers are named.

Ryan B.  
Freelancer

> **[frozenplague.net](http://frozenplague.net)**
>
> This domain may be for sale!

---

<div class="post-metadata">

**Author:** ![cojones](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/9f8e36/32.png) [@cojones](https://www.ruby-forum.com/u/cojones)\
**Post date:** [December 22, 2008, 4:29am UTC](https://www.ruby-forum.com/t/confused-with-naming-conventions/156149/5 "2008-12-22T04:29:59Z")

</div>

On Dec 21, 12:15 pm, Heinz S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Hey,
> 
> I’m currently reading “Agile Web D.” and doing the tutorial  
> (Depot). It says that the naming conventions are that the Controller  
> needs to be singular  
> […]

Controller names should generally be plural in Rails 2; see  
[http://giantrobots.thoughtbot.com/2008/1/8/rails-2-0-routing-changes](http://giantrobots.thoughtbot.com/2008/1/8/rails-2-0-routing-changes) .

## Best,

Marnen Laibow-Koser  
removed\_email\_address@domain.invalid  
[http://www.marnen.org](http://www.marnen.org)

---

<div class="post-metadata">

**Author:** ![cojones](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/9f8e36/32.png) [@cojones](https://www.ruby-forum.com/u/cojones)\
**Post date:** [December 22, 2008, 10:22am UTC](https://www.ruby-forum.com/t/confused-with-naming-conventions/156149/6 "2008-12-22T10:22:34Z")

</div>

Alright, thanks guys! A lot of editing is waiting for me now…
