Route alias, is it possible?

Posted by benoror on Stack Overflow See other posts from Stack Overflow or by benoror
Published on 2010-06-07T08:38:10Z Indexed on 2010/06/07 8:42 UTC
Read the original article Hit count: 356

Filed under:
|

I have a Vehicle model:

map.resources :vehicles, :has_many => :suppliers

Everything works great, but Vehicle has a boolean attribute is_truck. I want to make an Alias so I can get the same resources but with the "truck" word, I tried with:

map.trucks '/trucks', :controller => :vehicles, :action => :index, :is_truck => true
map.trucks '/trucks/by_supplier/:supplier', :controller => :vehicles, :action => :index, :is_truck => true

The first one works well, but when I search within a Form the second doesn't work and searches all suppliers.

Is it possible to map.resources for an alias ?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby