Module: MongoMapperExt::Tags::ClassMethods

Defined in:
lib/mongomapper_ext/tags.rb

Instance Method Summary collapse

Instance Method Details

#find_tags(regex, conditions = {}, limit = 30) ⇒ Object



22
23
24
# File 'lib/mongomapper_ext/tags.rb', line 22

def find_tags(regex, conditions = {}, limit = 30)
  self.database.eval("function(collection, a,b,c) { return find_tags(collection, a,b,c); }", self.collection_name, regex, conditions, limit)
end

#find_with_tags(*tags) ⇒ Object

Model.find_with_tags(“budget”, “big”, :limit => 4)



17
18
19
20
# File 'lib/mongomapper_ext/tags.rb', line 17

def find_with_tags(*tags)
  options = tags.extract_options!
  self.all(options.merge(:tags => tags))
end

#tag_cloud(conditions = {}, limit = 30) ⇒ Object



12
13
14
# File 'lib/mongomapper_ext/tags.rb', line 12

def tag_cloud(conditions = {}, limit = 30)
  self.database.eval("function(collection, q,l) { return tag_cloud(collection, q,l); }", self.collection_name, conditions, limit)
end