# Problem in Routes

**URL:** <https://www.ruby-forum.com/t/problem-in-routes/182675>\
**Category:** Rails\
**Created:** [February 1, 2010, 11:03am UTC](https://www.ruby-forum.com/t/problem-in-routes/182675 "2010-02-01T11:03:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![charanya](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/b5e925/32.png) [@charanya](https://www.ruby-forum.com/u/charanya)\
**Post date:** [February 1, 2010, 11:03am UTC](https://www.ruby-forum.com/t/problem-in-routes/182675/1 "2010-02-01T11:03:52Z")

</div>

Hi All

I had been using Rails 2.1.2 and in routes.rb i had a route defined  
like

map.namespace :mysite do |mysite|

mysite.questions ‘/questions.:format’, :controller =\>  
‘mysite\_questions’, :action =\> ‘index’

end

And now I have updated my rails version  
Now I get an error like this.

Rails 2.3.5 application starting on [http://0.0.0.0:3002](http://0.0.0.0:3002)  
Route segment “(.:format)?” cannot be optional because it precedes a  
required segment. This segment will be required.

Kindly Help me in this.

Thanks In Advance,

Charanya

---

<div class="post-metadata">

**Author:** ![charanya](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/b5e925/32.png) [@charanya](https://www.ruby-forum.com/u/charanya)\
**Post date:** [February 1, 2010, 11:23am UTC](https://www.ruby-forum.com/t/problem-in-routes/182675/2 "2010-02-01T11:23:16Z")

</div>

Charanya N. wrote:

> Hi All
> 
> I had been using Rails 2.1.2 and in routes.rb i had a route defined  
> like
> 
> map.namespace :mysite do |mysite|
> 
> mysite.questions ‘/questions.:format’, :controller =\>  
> ‘mysite\_questions’, :action =\> ‘index’
> 
> end
> 
> And now I have updated my rails version  
> Now I get an error like this.
> 
> Rails 2.3.5 application starting on [http://0.0.0.0:3002](http://0.0.0.0:3002)  
> Route segment “(.:format)?” cannot be optional because it precedes a  
> required segment. This segment will be required.
> 
> Kindly Help me in this.
> 
> Thanks In Advance,
> 
> Charanya

Check this out  
[http://dev.rubyonrails.org/attachment/ticket/9615/routing\_should\_not\_warn.diff](http://dev.rubyonrails.org/attachment/ticket/9615/routing_should_not_warn.diff)

-kannan

---

<div class="post-metadata">

**Author:** ![charanya](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/b5e925/32.png) [@charanya](https://www.ruby-forum.com/u/charanya)\
**Post date:** [February 1, 2010, 12:58pm UTC](https://www.ruby-forum.com/t/problem-in-routes/182675/3 "2010-02-01T12:58:23Z")

</div>

Thanks For the help Kannan.  
But I realised that,I get this error,only when I use this type of route

mysite.search\_questions ‘/questions/search.:format/:q’, :controller =\>  
‘mysite\_questions’, :action =\> ‘search’

This works perfectly fine in the previous old version of rails not with  
the newer version.

Kindly help.

Rails L. wrote:

> Charanya N. wrote:
> 
> > Hi All
> > 
> > I had been using Rails 2.1.2 and in routes.rb i had a route defined  
> > like
> > 
> > map.namespace :mysite do |mysite|
> > 
> > mysite.questions ‘/questions.:format’, :controller =\>  
> > ‘mysite\_questions’, :action =\> ‘index’
> > 
> > end
> > 
> > And now I have updated my rails version  
> > Now I get an error like this.
> > 
> > Rails 2.3.5 application starting on [http://0.0.0.0:3002](http://0.0.0.0:3002)  
> > Route segment “(.:format)?” cannot be optional because it precedes a  
> > required segment. This segment will be required.
> > 
> > Kindly Help me in this.
> > 
> > Thanks In Advance,
> > 
> > Charanya
> 
> Check this out  
> [http://dev.rubyonrails.org/attachment/ticket/9615/routing\_should\_not\_warn.diff](http://dev.rubyonrails.org/attachment/ticket/9615/routing_should_not_warn.diff)
> 
> -kannan
