# A little help with routes

**URL:** <https://www.ruby-forum.com/t/a-little-help-with-routes/114198>\
**Category:** Rails\
**Created:** [September 9, 2007, 5:48pm UTC](https://www.ruby-forum.com/t/a-little-help-with-routes/114198 "2007-09-09T17:48:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mix](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/919ad9/32.png) [@mix](https://www.ruby-forum.com/u/mix)\
**Post date:** [September 9, 2007, 5:48pm UTC](https://www.ruby-forum.com/t/a-little-help-with-routes/114198/1 "2007-09-09T17:48:41Z")

</div>

hi, i’m setting up some routes, but i’ve a little problem.  
i’ve written map.connect ‘’, :controller =\> ‘/categories’, :action =\>  
:index  
and tryed to show localhost:3000…ok, it works…partially, it changes  
the url to localhost:3000/categories  
how can i change it and set it to stay just with localhost:3000 ? i need  
this because of analytics, it doesn’t work if the url changes ☹  
thanks

---

<div class="post-metadata">

**Author:** ![mix](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/919ad9/32.png) [@mix](https://www.ruby-forum.com/u/mix)\
**Post date:** [September 9, 2007, 5:56pm UTC](https://www.ruby-forum.com/t/a-little-help-with-routes/114198/2 "2007-09-09T17:56:54Z")

</div>

Mix M. wrote:

> hi, i’m setting up some routes, but i’ve a little problem.  
> i’ve written map.connect ‘’, :controller =\> ‘/categories’, :action =\>  
> :index  
> and tryed to show localhost:3000…ok, it works…partially, it changes  
> the url to localhost:3000/categories  
> how can i change it and set it to stay just with localhost:3000 ? i need  
> this because of analytics, it doesn’t work if the url changes ☹  
> thanks

Well it shouldnt redirect to /categories if thats what you mean, it  
should stay as it is, maybe because you add / in the front.

map.connect ‘’, :controller =\> :categories, :action =\> :index

---

<div class="post-metadata">

**Author:** ![mix](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/919ad9/32.png) [@mix](https://www.ruby-forum.com/u/mix)\
**Post date:** [September 9, 2007, 7:14pm UTC](https://www.ruby-forum.com/t/a-little-help-with-routes/114198/3 "2007-09-09T19:14:51Z")

</div>

Jamal S. wrote:

> Mix M. wrote:
> 
> > hi, i’m setting up some routes, but i’ve a little problem.  
> > i’ve written map.connect ‘’, :controller =\> ‘/categories’, :action =\>  
> > :index  
> > and tryed to show localhost:3000…ok, it works…partially, it changes  
> > the url to localhost:3000/categories  
> > how can i change it and set it to stay just with localhost:3000 ? i need  
> > this because of analytics, it doesn’t work if the url changes ☹  
> > thanks
> 
> Well it shouldnt redirect to /categories if thats what you mean, it  
> should stay as it is, maybe because you add / in the front.
> 
> map.connect ‘’, :controller =\> :categories, :action =\> :index

opss, found the error, was another method that was called and which did  
a redirect…btw, now works… but is it normal that it doesn’t use the  
controller? i’ve set a variable @xxx = ‘test’ and when in the view i  
print @xxx.nil? the result it’s true O\_o

---

<div class="post-metadata">

**Author:** ![mix](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/919ad9/32.png) [@mix](https://www.ruby-forum.com/u/mix)\
**Post date:** [September 9, 2007, 7:20pm UTC](https://www.ruby-forum.com/t/a-little-help-with-routes/114198/4 "2007-09-09T19:20:55Z")

</div>

found the problem (bug?)

map.connect ‘’, :controller =\> :categories, :action =\> :index

doesn’t use the controller, but just the view (also if i don’t  
understand why layout nil works…)

map.connect ‘’, :controller =\> :categories, :action =\> ‘index’

works without problems 🙂
