I have the following mapping (@location_matches represents a standard SQL query`:
@matches = @location_matches.map { |listing|
}.compact
When I go to my view, I can access @matches.username, etc, etc, etc.
However when I add this model method, I lose all access to any of the info!
@matches = @location_matches.map { |listing|
listing.compute_score(current_user)
}.compact
any ideas why? is there a better way to do this? thank ya
Here’s sorting by computed score:
http://www.ruby-doc.org/core/classes/Enumerable.html#M001481
Put
.reverseat the end if you want it reverse-sorted.