# Problems with Routes for user area

**URL:** <https://www.ruby-forum.com/t/problems-with-routes-for-user-area/149863>\
**Category:** Rails\
**Created:** [September 30, 2008, 5:00pm UTC](https://www.ruby-forum.com/t/problems-with-routes-for-user-area/149863 "2008-09-30T17:00:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Denix](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/919ad9/32.png) [@Denix](https://www.ruby-forum.com/u/Denix)\
**Post date:** [September 30, 2008, 5:00pm UTC](https://www.ruby-forum.com/t/problems-with-routes-for-user-area/149863/1 "2008-09-30T17:00:37Z")

</div>

I want such urls in at site:  
[http://mysite.com/freddy/profile/view](http://mysite.com/freddy/profile/view)  
[http://mysite.com/freddy/blog/view](http://mysite.com/freddy/blog/view)  
…  
so I want username in my url, and it should use controllers from  
folder: member

And I use this route:

```
map.username ":username/:controller/:action/:id",
          :controller => 'member/:controller',
          :action => ':action',
          :id => ':id',
          :requirements => { :username => /[a-zA-Z0-9_]+/}
```

But it gives me error: “wrong constant name :controllerController”.

What’s wrong?

---

<div class="post-metadata">

**Author:** ![Denix](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/919ad9/32.png) [@Denix](https://www.ruby-forum.com/u/Denix)\
**Post date:** [October 2, 2008, 4:59pm UTC](https://www.ruby-forum.com/t/problems-with-routes-for-user-area/149863/2 "2008-10-02T16:59:00Z")

</div>

Denix wrote:

> I want such urls in at site:  
> [http://mysite.com/freddy/profile/view](http://mysite.com/freddy/profile/view)  
> [http://mysite.com/freddy/blog/view](http://mysite.com/freddy/blog/view)  
> …  
> so I want username in my url, and it should use controllers from  
> folder: member
> 
> And I use this route:
> 
> ```
> map.username ":username/:controller/:action/:id",
> :controller => 'member/:controller',
> :action => ':action',
> :id => ':id',
> :requirements => { :username => /[a-zA-Z0-9_]+/}
> ```
> 
> But it gives me error: “wrong constant name :controllerController”.
> 
> What’s wrong?

Hey Denix,  
Here is an example from the rails api regarding “Regular Expressions and  
Parameters”:

map.geocode ‘geocode/:postalcode’, :controller =\> ‘geocode’,  
:action =\> ‘show’, :postalcode =\> /\d{5}(-\d{4})?/

Kind of similar to your example, no? If I were to re-write your write,  
it might look _something_ like this:  
map.username “:username/:controller/:action”,  
:controller =\> ‘member’,  
:action =\> ‘show’,  
:requirements =\> { :username =\> /[a-zA-Z0-9\_]+/}

Hope this helps a bit, read more about routing here:  
[http://api.rubyonrails.org/classes/ActionController/Routing.html](http://api.rubyonrails.org/classes/ActionController/Routing.html)
