I'm using the Rails Geocoder Gem, Rails 4.2 and MySqL. I want to detect how many travels are compatible with some boxes.
Travels and boxes have these fields: departure_address, departure_lat, departure_long and arrival_address, arrival_lat, arrival_long.
When I want to check if a travel is compatible with a box I try with this query:
Travel.near([Box.last.departure_lat, Box.last.departure_long], 50)
I know it is considering only departure_address and not arrival_address but anyway it doesn't work because Geocoder tries to find a 'latitude' field in table 'travels' even if I called it 'dep_lat' and so on for longitude.
I want to solve this problem and then think to combine it with arrivals. Thanks!