Sha256: 767a339a6d2998d7d1e1ca1d0537456493662785144409e0800bd1e7a6066d23

Contents?: true

Size: 551 Bytes

Versions: 27

Compression:

Stored size: 551 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

27 entries across 27 versions & 2 rubygems

Version Path
alchemy_cms-3.2.1 app/models/alchemy/tag.rb
alchemy_cms-3.1.3 app/models/alchemy/tag.rb
lc_alchemy_cms-3.2.1 app/models/alchemy/tag.rb
lc_alchemy_cms-3.2.0 app/models/alchemy/tag.rb
alchemy_cms-3.2.0 app/models/alchemy/tag.rb
alchemy_cms-3.2.0.rc1 app/models/alchemy/tag.rb
alchemy_cms-3.2.0.beta app/models/alchemy/tag.rb
alchemy_cms-3.1.1 app/models/alchemy/tag.rb
alchemy_cms-3.0.4 app/models/alchemy/tag.rb
alchemy_cms-3.1.0 app/models/alchemy/tag.rb
alchemy_cms-3.1.0.rc3 app/models/alchemy/tag.rb
alchemy_cms-3.1.0.rc2 app/models/alchemy/tag.rb
alchemy_cms-3.1.0.rc1 app/models/alchemy/tag.rb
alchemy_cms-3.1.0.beta6 app/models/alchemy/tag.rb
alchemy_cms-3.1.0.beta5 app/models/alchemy/tag.rb
alchemy_cms-3.1.0.beta4 app/models/alchemy/tag.rb
alchemy_cms-3.0.3 app/models/alchemy/tag.rb
alchemy_cms-3.1.0.beta3 app/models/alchemy/tag.rb
alchemy_cms-3.1.0.beta2 app/models/alchemy/tag.rb
alchemy_cms-3.1.0.beta1 app/models/alchemy/tag.rb