lib/fuzzily/model.rb in fuzzily-0.3.0 vs lib/fuzzily/model.rb in fuzzily-0.3.1

- old
+ new

@@ -33,12 +33,11 @@ def _matches_for_trigrams(trigrams) self. scoped(:select => 'owner_id, owner_type, count(*) AS matches, MAX(score) AS score'). scoped(:group => 'owner_id, owner_type'). scoped(:order => 'matches DESC, score ASC'). - with_trigram(trigrams). - map(&:owner) + with_trigram(trigrams) end def _add_fuzzy_scopes named_scope :for_model, lambda { |model| { :conditions => { :owner_type => model.kind_of?(Class) ? model.name : model } @@ -57,11 +56,10 @@ def _matches_for_trigrams(trigrams) self. select('owner_id, owner_type, count(*) AS matches, MAX(score) AS score'). group('owner_id, owner_type'). order('matches DESC, score ASC'). - with_trigram(trigrams). - map(&:owner) + with_trigram(trigrams) end def _add_fuzzy_scopes scope :for_model, lambda { |model| where(:owner_type => model.kind_of?(Class) ? model.name : model)