I have a strange situation happening with meta_search. This is a little bit specialized as I am using two named scopes (added to meta_search’s search_methods) which do a distance search. Curious if anyone has an idea before I start delving into the gem itself to track down. Individually each returns a result (the same record), which is what I expect. But when they are both submitted in a search I get 0 matches.
(rdb:1) self.bands.search(:bands_with_location_near=>[“San Francisco”, “10”]).first.id 9694 (rdb:1) self.bands.search(:bands_with_gig_location_near=>[“San Francisco”, “10”]).first.id 9694 (rdb:1) self.bands.search(:bands_with_location_near=>[“San Francisco”, “10”], :bands_with_gig_location_near=>[“San Francisco”, “10”]).count 0
These are the named scopes being used. The results above make no sense to me.
scope :bands_with_location_near, lambda { |array_address_and_radius_miles| address,radius_miles = array_address_and_radius_miles; Account.joins(:band_profile, :location) .where(“locations.id IN (?)”, Location.near(address,radius_miles,‘Account’).all.map(&:id)) }
scope :bands_with_gig_location_near, lambda { |array_address_and_radius_miles| address,radius_miles = array_address_and_radius_miles; Account.joins(:band_profile, :gigs => [:venue => :location]) .where(“locations.id IN (?)”, Location.near(address,radius_miles,‘Venue’).all.map(&:id)) }