Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Taggable on custom fields for Mongoid

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .rspec
Octocat-spinner-32 .travis.yml
Octocat-spinner-32 CHANGELOG.md
Octocat-spinner-32 Gemfile
Octocat-spinner-32 Gemfile.lock
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 mongoid_taggable_on.gemspec
README.md

Mongoid Taggable On

Mongoid Taggable provides some helpers to create taggable documents, can use many fields.

Status

  • Gem Version
  • CI Status

Installation

You can simple install from rubygems:

gem install mongoid_taggable_on

or in Gemfile:

gem 'mongoid_taggable_on'

Usage

中文介绍去这里

class Movie
  include Mongoid::Document
  include Mongoid::TaggableOn

  taggable_on :actors, :index => false
  taggable_on :directors
  taggable_on :countries

  field :title
  field :summary
end

Now you can use sample:

irb> m = Movie.new
irb> m.actors_list = "Jason Statham, Joseph Gordon-Levitt, Johnny Depp, Nicolas Cage"
irb> m.actors
["Jason Statham", "Joseph Gordon-Levitt", "Johnny De", "Nicolas Cage"]
irb> m.country_list = "United States| China|Mexico"
irb> m.countries
["United States","China","Mexico"]

find with tag:

irb> Movie.tagged_with_on(:actors, "Jason Statham, Joseph Gordon-Levitt")
irb> Movie.tagged_with_on(:actors, "Jason Statham, Joseph Gordon-Levitt", :match => :any)
irb> Movie.tagged_with_on(:actors, "Nicolas Cage", :match => :not)

Allow split chars

, ,| /

Who used that?

In 720p.so, the Movie actors, directors, languages, countries, tags all base in mongoid_taggable_on.

Something went wrong with that request. Please try again.