GithubHelp home page GithubHelp logo

guniorobot / mongoid-simple-tags Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hashdog/mongoid-simple-tags

1.0 2.0 0.0 88 KB

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

Home Page: http://www.chebyte.com

License: MIT License

mongoid-simple-tags's Introduction

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.5"

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 © 2011 chebyte(mauro torres). See LICENSE.txt for further details.

mongoid-simple-tags's People

Contributors

chebyte avatar hendriklouw avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.