search for: distance_between_zips

Displaying 1 result from an estimated 1 matches for "distance_between_zips".

2006 Mar 21
2
Sorting by computed temporary field
...ake a new find_and_sort method that adds a new @distance member element and sorts the new collection. Would something like this work? def find_and_sort(event_id) @rides = Ride.find(:all, :conditions => {"event_id = ?", event_id})" for ride in @rides ride.newdistance = distance_between_zips(session[:user].zip_code, Event.find(event_id).zip_code); end uhm.... sort @rides by newdistance end What if I want to also remove items from @rides before they are displayed if that newdistance is too large or some other condition? uhm... I''m stumped, I guess. That''...