basic and simple tagging system for mongoid using map-reduce function
Ruby
Switch branches/tags
Nothing to show
Pull request Compare This branch is 3 commits ahead, 63 commits behind hashdog:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec
.gitignore
.rspec
Gemfile
Gemfile.lock
LICENSE.txt
README.rdoc
Rakefile
VERSION
mongoid-simple-tags.gemspec

README.rdoc

mongoid-simple-tags

mongoid-simple-tags is a basic and simple tagging system for mongoid using map-reduce function

Install

Add the following to Gemfile:

  gem "mongoid-simple-tags", "0.0.6"

Usage

Model

class User
  include Mongoid::Document
  include Mongoid::Document::Taggable
end

Console

u = User.new(:name => "Tuquito")
u.tag_list = "linux, tucuman, free software"      
u.tags     # => ["linux","tucuman","free software"]
u.save

User.tagged_with("linux") # => u
User.tagged_with(["tucuman", "free software"]) # => u

u2 = User.new(:name => "ubuntu")
u2.tag_list = "linux"
u2.save

User.tagged_with("linux") # => [u, u2]

#using map-reduce function

User.all_tags #=>[{:name=>"free software", :count=>1}, {:name=>"linux", :count=>2}, {:name=>"tucuman", :count=>1}]

Copyright

Copyright © 2011 chebyte(mauro torres). See LICENSE.txt for further details.