Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mongoid-simple-tags

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongoid-simple-tags

  • 0.1.3
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

= mongoid-simple-tags {}[http://travis-ci.org/chebyte/mongoid-simple-tags] {}[https://codeclimate.com/github/chebyte/mongoid-simple-tags] {Gem Version}[http://badge.fury.io/rb/mongoid-simple-tags]

mongoid-simple-tags is a basic and simple tagging system for mongoid using map-reduce function (no backwards compatibility with mongoid v2!)

== Install

Add the following to Gemfile:

gem "mongoid-simple-tags", "0.1.2"

== Usage

=== Model

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

=== Console

u = User.create(:name => "Tuquito", tag_list: "linux, tucuman, free software")

u.tags # => ["linux","tucuman","free software"]

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

User.tagged_with_all(["linux"]) # => [u] User.tagged_with_all(["linux", "foo"]) # => []

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

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

User.tagged_with_all(["linux", "tucuman"]) # => [u]

using map-reduce function

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

User.tag_list #=>["free software", "linux", "tucuman"]

== Give back

If you're using mongoig-simple-tags and you or your company is making money from it, then please consider donating via {Gittip}[https://www.gittip.com/chebyte/] so that I can continue to improve it.

{}[https://www.gittip.com/chebyte/]

== Copyright

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

FAQs

Package last updated on 24 May 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc