Module: Mongoid::Searchable::InstanceMethods
- Defined in:
- lib/mongoid/searchable.rb
Instance Method Summary collapse
-
#build_keywords ⇒ Object
Builds a list of keywords contained in the document given the keyword fields previously declared and stores them in the keywords field.
Instance Method Details
#build_keywords ⇒ Object
Builds a list of keywords contained in the document given the keyword fields previously declared and stores them in the keywords field
Returns nothing.
120 121 122 123 124 125 126 |
# File 'lib/mongoid/searchable.rb', line 120 def build_keywords keywords = [] self.class.searchable_fields.each do |f| keywords << self.class.clean_keywords(send("#{f}")) end write_attribute(self.class.keywords_field, keywords.flatten.uniq) end |