Skip to content

Commit

Permalink
Merge pull request #49 from borodiychuk/patch-1
Browse files Browse the repository at this point in the history
If one of the fields in search_in is a method, then the old-way klass[field] returns nil.
With this fix it executes the method and uses its result. Also, for regular fields it also works fine.
  • Loading branch information
mauriciozaffari committed Feb 7, 2013
2 parents dba5bcc + 69f2e2d commit ba4df9f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/mongoid_search/util.rb
Expand Up @@ -29,7 +29,7 @@ def self.keywords(klass, field)
end
end
else
value = klass[field]
value = klass.send(field)
value = value.join(' ') if value.respond_to?(:join)
normalize_keywords(value) if value
end
Expand Down

0 comments on commit ba4df9f

Please sign in to comment.