Forum: Ruby on Rails routes.rb question

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Richard S. (Guest)
on 2009-01-09 03:06
I'm trying to go to localhost/phrases/new

where 'phrases' is my controller and 'new' is my action which will
simply show my new.html.erb

In my routes i have:
  map.connect '/:controller/:action'

Yet every time i go to phrases/new, I get redirected to my show action

http://pastie.org/356249

I can get around this if i use:
  map.connect '/:controller/:action.'

But i find it distasteful to have that period at the end of my URL. Any
clue why everything gets redirected to :action => 'show'
Joshua A. (Guest)
on 2009-01-09 06:29
Richard,

Why not just lose this line from your routes file:

map.connect '/:controller/:action'

Since map.resources came along, I always delete the default stuff that
comes in the routes file. See if /phrases/new works the way it should
after removing that line.

-- Josh
http://iammrjoshua.com


Richard S. wrote:
> I'm trying to go to localhost/phrases/new
>
> where 'phrases' is my controller and 'new' is my action which will
> simply show my new.html.erb
>
> In my routes i have:
>   map.connect '/:controller/:action'
>
> Yet every time i go to phrases/new, I get redirected to my show action
>
> http://pastie.org/356249
>
> I can get around this if i use:
>   map.connect '/:controller/:action.'
>
> But i find it distasteful to have that period at the end of my URL. Any
> clue why everything gets redirected to :action => 'show'
Bobnation (Guest)
on 2009-01-09 07:29
(Received via mailing list)
Try what was recommended and what does your controller look like?

On Jan 8, 10:29 pm, Joshua A. <removed_email_address@domain.invalid>
This topic is locked and can not be replied to.