Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Allow you to bulk add/remove tags directly on an ActiveRecord::Relation
Ruby
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.gitignore
README.md
acts_as_taggable_on_active_record_relation.rb

README.md

ActsAsTaggableOnActiveRecordRelation

Allow you to bulk add/remove tags directly on an ActiveRecord::Relation

How to use it

If you are using Rails 3 Just put the .rb file it in your /lib folder

# Our ActiveRecord::Relation
clients = Client.where('created_at > ?', Time.now - 2.months)
# Our tags
tags_to_add = ['here','a','bunch','of','tags']
tags_to_remove = ['useless','now']
# Adding and removing tags
# (You can specify the tagging context as a second parameter) 
clients.add_tags(tags_to_add).remove_tags(tags_to_add, 'jobs')

Note:

Works on MySQL databases

Something went wrong with that request. Please try again.