0.0
No commit activity in last 3 years
No release in over 3 years
Simple tagging for Rails 4+
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

~> 4.0
 Project Readme

Tagliatelle

Gem Version

Installation

Add this line to your application's Gemfile:

gem "tagliatelle"

And then execute:

$ bundle

Generate model classes and migrations:

$ rails generate tagliatelle:install

Review the generated migrations then migrate:

$ rake db:migrate

Usage

Tagliatelle expects two classes to be defined:

class Tag < ActiveRecord::Base
  include Tagliatelle::Tag
end

class Tagging < ActiveRecord::Base
  include Tagliatelle::Tagging
end

You can add or override behavior to these classes as needed.

Then to make an object taggable:

class Article < ActiveRecord::Base
  include Tagliatelle::Taggable
end

To tag an object:

article = Article.first
article.tag_list = "foo, bar"
article.save

To retrieve the tags of an object:

article = Article.first
article.tag_list

To query objects based on tags:

Article.tagged_with(["foo", "bar"])