# Does a "User" controller have a naming conflict within ROR?

**URL:** <https://www.ruby-forum.com/t/does-a-user-controller-have-a-naming-conflict-within-ror/70675>\
**Category:** Rails\
**Created:** [October 1, 2006, 9:22pm UTC](https://www.ruby-forum.com/t/does-a-user-controller-have-a-naming-conflict-within-ror/70675 "2006-10-01T21:22:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ericgoodwin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/c68b51/32.png) [@ericgoodwin](https://www.ruby-forum.com/u/ericgoodwin)\
**Post date:** [October 1, 2006, 9:22pm UTC](https://www.ruby-forum.com/t/does-a-user-controller-have-a-naming-conflict-within-ror/70675/1 "2006-10-01T21:22:51Z")

</div>

Hi,

I called one of my controllers “User”.  
I then created a modular controller under that called “Profile.”  
I have other modular controllers in my program that works fine, however,  
in the routing, when I mirror the other routes and do:

map.connect ‘profile/:action/:id’, :controller=\>‘user/profile’

it doesnt work. However if I make controller called users, then I can  
do:

map.connect ‘profile/:action/:id’, :controller=\>‘userS/profile’

it does work. Any idea why this is or how to fix it. I would just use  
“Users” but its inconsistent with my singular controller naming  
scheme…

---

<div class="post-metadata">

**Author:** ![ericgoodwin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/c68b51/32.png) [@ericgoodwin](https://www.ruby-forum.com/u/ericgoodwin)\
**Post date:** [October 2, 2006, 6:04am UTC](https://www.ruby-forum.com/t/does-a-user-controller-have-a-naming-conflict-within-ror/70675/2 "2006-10-02T06:04:26Z")

</div>

anybody?

Eric G. wrote:

> Hi,
> 
> I called one of my controllers “User”.  
> I then created a modular controller under that called “Profile.”  
> I have other modular controllers in my program that works fine, however,  
> in the routing, when I mirror the other routes and do:
> 
> map.connect ‘profile/:action/:id’, :controller=\>‘user/profile’
> 
> it doesnt work. However if I make controller called users, then I can  
> do:
> 
> map.connect ‘profile/:action/:id’, :controller=\>‘userS/profile’
> 
> it does work. Any idea why this is or how to fix it. I would just use  
> “Users” but its inconsistent with my singular controller naming  
> scheme…

---

<div class="post-metadata">

**Author:** ![ericgoodwin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/c68b51/32.png) [@ericgoodwin](https://www.ruby-forum.com/u/ericgoodwin)\
**Post date:** [October 2, 2006, 9:25am UTC](https://www.ruby-forum.com/t/does-a-user-controller-have-a-naming-conflict-within-ror/70675/3 "2006-10-02T09:25:03Z")

</div>

I have a controller called user without any problems. What however can  
be a problem is if you have a model class called User, IIRC rails will  
get confused (have a modular controller may or may not be a factor, I  
can’t remember)

Fred

---

<div class="post-metadata">

**Author:** ![ericgoodwin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/c68b51/32.png) [@ericgoodwin](https://www.ruby-forum.com/u/ericgoodwin)\
**Post date:** [October 2, 2006, 10:35am UTC](https://www.ruby-forum.com/t/does-a-user-controller-have-a-naming-conflict-within-ror/70675/4 "2006-10-02T10:35:45Z")

</div>

Hmm, thats interesting because I do have a model called User, do you  
that is it? Is there anyway around this?

Fred wrote:

> I have a controller called user without any problems. What however can  
> be a problem is if you have a model class called User, IIRC rails will  
> get confused (have a modular controller may or may not be a factor, I  
> can’t remember)
> 
> Fred

---

<div class="post-metadata">

**Author:** ![ericgoodwin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/c68b51/32.png) [@ericgoodwin](https://www.ruby-forum.com/u/ericgoodwin)\
**Post date:** [October 2, 2006, 4:27pm UTC](https://www.ruby-forum.com/t/does-a-user-controller-have-a-naming-conflict-within-ror/70675/5 "2006-10-02T16:27:27Z")

</div>

Eric G. wrote:

> I called one of my controllers “User”.  
> I then created a modular controller under that called “Profile.”

You can’t have two Modules with the same name. Class is an extension of  
Module, so the class User conflicts with the module User which contains  
ProfileController.

I had the same problem and solved it the same way you did, by renaming  
the module Users.
