Sha256: 49570070f8514a446735e8a7d08a3c1eaadcc20cf305ca9071a3be04ef414636
Contents?: true
Size: 841 Bytes
Versions: 56
Compression:
Stored size: 841 Bytes
Contents
# frozen_string_literal: true # == Schema Information # # Table name: gutentag_tags # # id :integer not null, primary key # name :string # taggings_count :integer default(0) # # Just holds some useful tag methods. # The original Tag model is Gutentag::Tag module Alchemy class Tag < Gutentag::Tag def self.ransackable_attributes(_auth_object = nil) %w[created_at id name taggings_count updated_at] end def self.ransackable_associations(_auth_object = nil) %w[taggings] end # Replaces tag with new tag on all models tagged with tag. def self.replace(tag, new_tag) tag.taggings.collect(&:taggable).each do |taggable| taggable.tag_list.delete(tag.name) taggable.tag_list << new_tag.name taggable.save end end end end
Version data entries
56 entries across 56 versions & 1 rubygems