# File lib/padrino-contrib/orm/mongo_mapper/search.rb, line 21 def has_search(*fields) @_search_fields = fields end
# File lib/padrino-contrib/orm/mongo_mapper/search.rb, line 25 def search(text, options={}) if text re = Regexp.new(Regexp.escape(text), 'i') where = @_search_fields.map { |field| "this.#{field}.match(#{re.inspect})" }.join(" || ") options.merge!("$where" => where) end options.delete(:paginate) ? paginate(options) : all(options) end
Generated with the Darkfish Rdoc Generator 2.