# "Ugly URLs" don't work with map.resources?

**URL:** <https://www.ruby-forum.com/t/ugly-urls-dont-work-with-map-resources/87138>\
**Category:** Rails\
**Created:** [February 28, 2007, 1:33pm UTC](https://www.ruby-forum.com/t/ugly-urls-dont-work-with-map-resources/87138 "2007-02-28T13:33:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mknw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b782af/32.png) [@mknw](https://www.ruby-forum.com/u/mknw)\
**Post date:** [February 28, 2007, 1:33pm UTC](https://www.ruby-forum.com/t/ugly-urls-dont-work-with-map-resources/87138/1 "2007-02-28T13:33:09Z")

</div>

All,

I’ve a Course model in my application and so my routes file contains  
the standard:

map.resources :courses

and then of course:

map.connect ‘:controller/:action/:id.:format’  
map.connect ‘:controller/:action/:id’

URLs like “[www.example.com/courses/1;edit](http://www.example.com/courses/1;edit)” and “[www.example.com/](http://www.example.com/)  
courses/edit/1” work fine, but when I use something like this  
“[www.example.com/courses/edit?id=1](http://www.example.com/courses/edit?id=1)” it doesn’t work. The “show” action  
is called instead of “edit”. Removing map.resources line fixes it of  
course, but I was wondering if there’s a way to have the cake and eat  
it too?

I need the “[www.example.com/courses/edit?id=1](http://www.example.com/courses/edit?id=1)” format to be able to  
send a GET request through a form with a select\_tag setting an id. So  
I’d like to do something like this:

Edit course  
\<% form\_for(:course, :url =\> {:controller =\> ‘courses’, :action =\>  
‘edit’},  
:html =\> { :method =\> :get }) do |f| %\>  
\<%= select\_tag ‘id’,  
options\_from\_collection\_for\_select(Course.find(:all), ‘id’,  
‘name\_and\_dates’) %\>  
\<%= submit\_tag ‘Go!’ %\>  
\<% end -%\>

So, alternatively, is there any other way to do this (and make it  
degradable to non-JS browsers)?

Thanks,  
Maciek
