Forum: Ruby on Rails "Ugly URLs" don't work with map.resources?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
E3eb0d7da7c54e7c8f247167bf886719?d=identicon&s=25 Maciej Kolodziej (mknw)
on 2007-02-28 13:33
(Received via mailing list)

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 ";edit" and "
courses/edit/1" work fine, but when I use something like this
"" 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 "" 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 =>
                :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)?

This topic is locked and can not be replied to.