Hi,
I'm having trouble with getting a named scope working using using an attribute of the associated model other than the id column.
I have a Firm model which has a city_id column. I also have a City model with a name column.
I want to get restful urls like this so as to make use of the has_scope gem and have skinny controllers
http://localhost:3000/firms?by_city=Dublin
However using the present code I can only insert the city Id
http://localhost:3000/firms?by_city=546
Here is my named_route
class Firm < ActiveRecord::Base
named_scope :by_city, proc {|city| { :conditions => { :city => city } } }
end
Any ideas about how to modify the named scope so as to generate urls using the name would be greatly appreciated!
Thanks,
Jack