Sha256: ad78255e73d00fec2f1736ef53c90c583cde331023652cca1a631af36e1542af

Contents?: true

Size: 549 Bytes

Versions: 22

Compression:

Stored size: 549 Bytes

Contents

# == Schema Information
#
# Table name: tags
#
#  id   :integer          not null, primary key
#  name :string(255)
#

# Just holds some useful tag methods.
# The original Tag model is ActsAsTaggableOn::Tag
module Alchemy
  class Tag < ActsAsTaggableOn::Tag
    # 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

22 entries across 22 versions & 1 rubygems

Version Path
alchemy_cms-3.6.7 app/models/alchemy/tag.rb
alchemy_cms-3.6.6 app/models/alchemy/tag.rb
alchemy_cms-3.6.5 app/models/alchemy/tag.rb
alchemy_cms-3.6.4 app/models/alchemy/tag.rb
alchemy_cms-3.6.3 app/models/alchemy/tag.rb
alchemy_cms-3.6.2 app/models/alchemy/tag.rb
alchemy_cms-3.6.1 app/models/alchemy/tag.rb
alchemy_cms-4.0.0.beta app/models/alchemy/tag.rb
alchemy_cms-3.6.0 app/models/alchemy/tag.rb
alchemy_cms-3.5.0 app/models/alchemy/tag.rb
alchemy_cms-3.4.2 app/models/alchemy/tag.rb
alchemy_cms-3.5.0.rc2 app/models/alchemy/tag.rb
alchemy_cms-3.5.0.rc1 app/models/alchemy/tag.rb
alchemy_cms-3.4.1 app/models/alchemy/tag.rb
alchemy_cms-3.3.3 app/models/alchemy/tag.rb
alchemy_cms-3.3.2 app/models/alchemy/tag.rb
alchemy_cms-3.4.0 app/models/alchemy/tag.rb
alchemy_cms-3.4.0.rc1 app/models/alchemy/tag.rb
alchemy_cms-3.3.1 app/models/alchemy/tag.rb
alchemy_cms-3.3.0 app/models/alchemy/tag.rb