Project

my_tags

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

Development

~> 0.4.0
~> 1.3.7

Runtime

>= 3.2.0
 Project Readme

Simple gem for Tags

###Allow add Tags for any model

#####Installation:

Add gem 'my_tags' to Gemfile

Add has_many_tags for model, which you want to use tags

class Post < ActiveRecord::Base
has_many_tags

Run rake my_tags:install:migrations and rake:db:migrate

Done!

Done, ready for using:

post = Post.create(name: 'Post with tags')

post.tags => []

post.tags.count => 0

post.tag_list << 'First tag'

post.tags.count => 1

post.tags.first.delete

post.tags.count => 0

Or you can use this method:

@post.process_tags('animals, pets') or @post.process_tags(['animals', ['pets'])

UI features:

Add to Routes.rb mount MyTags::Engine, at: "/my_tags"

Add to your applications.js: //= require my_tags, applications.css: //= require my_tags

Use = tags_field_tag(@post) helpers method in views (it draw input field with autocompete popup)

= all_tags method for display all tags