0.01
No commit activity in last 3 years
No release in over 3 years
Mongoid::Tags adds a simple tagging system to your Mongoid documents, and allows you to query them using a boolean search syntax.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 5.0
~> 10.0
~> 0.40
~> 0.8

Runtime

< 6.0.0, >= 4.0
< 7.0.0, >= 4.0.0
~> 1.5
 Project Readme

mongoid-tags Build Status

Mongoid::Tags adds a simple tagging system to your Mongoid documents, and allows you to query them using a boolean search syntax.

Installation

In your Gemfile:

gem 'mongoid-tags'

Usage

class Document
  include Mongoid::Document
  include Mongoid::Tags
end

# Documents tagged foo || bar
Document.tagged('foo bar')

# Documents tagged foo && bar
Document.tagged('+foo bar')

# Documents tagged foo, but !bar
Document.tagged('foo -bar')

# Documents tagged foo and bar or baz
Document.tagged('(+foo +bar) baz')

# Documents tagged foo and bar, or foo and baz
Document.tagged('(+foo +bar)(+foo +baz)')

# Chaining calls
Document.where(published: true).tagged('foo').desc(:created_at)

Be sure to checkout test/integration_test.rb for more examples.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Copyright

(The MIT license)

Copyright (c) 2012-2016 Mario Uher

See LICENSE.md.