Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
31 lines (23 sloc) 0.659 kB
require 'active_support/concern'
module Gutentag::ActiveRecord
extend ActiveSupport::Concern
module ClassMethods
def has_many_tags
has_many :taggings, :class_name => 'Gutentag::Tagging', :as => :taggable,
:dependent => :destroy
has_many :tags, :class_name => 'Gutentag::Tag',
:through => :taggings
after_save { |instance| Gutentag::Persistence.new(instance).persist }
end
end
def reset_tag_names
@tag_names = nil
end
def tag_names
@tag_names ||= tags.pluck(:name)
end
def tag_names=(names)
Gutentag.dirtier.call self, names if Gutentag.dirtier
@tag_names = names
end
end
Jump to Line
Something went wrong with that request. Please try again.