I have two models / tables: services and city
Service Model:
belongs_to :origin_city, class_name: 'City' belongs_to :destiny_city, class_name: 'City'
How to create an area for ordering a city name?
I am trying something like this:
scope :by_city_name, -> { joins(:city).order("cities.name asc") }
But I just want to order the city of origin of the service in one area. And the service of the city of fate in another area.
source share