Permalink
Browse files

Adds support for serialized hashes

  • Loading branch information...
1 parent e493a9e commit c78b572b4bc993746461e54af53eaf6e23237690 @ekampp ekampp committed Jun 2, 2012
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/mongoid_search/util.rb
@@ -13,7 +13,11 @@ def self.keywords(klass, field, stem_keywords, ignore_list)
attribute.map(&method).map { |t| Util.normalize_keywords t, stem_keywords, ignore_list }
end
else
- Util.normalize_keywords(attribute.send(method), stem_keywords, ignore_list)
+ if attribute.respond_to?(method)
+ Util.normalize_keywords(attribute.send(method), stem_keywords, ignore_list)
+ else # If the field is a serialized hash
+ Util.normalize_keywords(klass.send(key)[method.to_sym], stem_keywords, ignore_list)
+ end
end
end
end

0 comments on commit c78b572

Please sign in to comment.