-
[Rails] route problem
Hi,
I'm stuck again with a route. Instead of using :controller/:action/:id like this
/hotel/show/2, I'd like to use a kind of pretty url like
/hotel/show/city-ref-id.rhtml or better html where city, ref and id are fields in the hotels table.
Is it possible to do it in a simple way?
-
:controller/:action/:city-:ref-:id.html
Wouldn't that work, as long as you match up city and ref in your queries and set proper regex patterns (i.e. no dashes in :city or :ref)?
-
The problem is that I need to retrieve city name from cities table because :city will only returns an id (FK)
-
Use a custom find() query with :include or :joins, that should get the city name.