Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Ruby
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
spec
.gitignore
.travis.yml
Gemfile
MIT-LICENSE
README.md
Rakefile
mongoid_smart_tags.gemspec

README.md

Mongoid Smart Tags Build Status

Mongoid Smart Tags provide module that helps easily create and manage tagged documents. It's dead simple, but has some "smart" features.

Usage

Add gem to your Gemfile:

gem 'mongoid_smart_tags'

Add module to your model:

class Girl
  include Mongoid::Document
  include Mongoid::SmartTags

  field :name, type: String
end

Suppose you have a huge tagged collection of pictures of pretty girls. You can organize and search it like this:

girl = Girl.create(name: 'Pamela Anderson', tags: 'hot wears_bikini huge_boobs blonde')
# or
girl = Girl.create(name: 'Pamela Anderson', tags: [ 'hot', 'wears_bikini', 'huge_boobs', 'blonde' ])

girl.tags # => [ 'hot', 'wears_bikini', 'huge_boobs', 'blonde' ]

# search for girls who are hot AND are brunettes.
Girl.search_by_tags('hot brunette')

# now hot blonde girls who wear bikini but without huge boobies
Girl.search_by_tags('hot blonde wears_bikini -huge_boobs')

Smart Tags requires Ruby 1.9.3

License

Mongoid Smart Tags is released under the MIT license: http://www.opensource.org/licenses/MIT

Something went wrong with that request. Please try again.