Skip to content

Commit

Permalink
Adds support for serialized hashes
Browse files Browse the repository at this point in the history
  • Loading branch information
ekampp committed Jun 2, 2012
1 parent e493a9e commit c78b572
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/mongoid_search/util.rb
Expand Up @@ -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
Expand Down

0 comments on commit c78b572

Please sign in to comment.