Module: TaggingControllerOverrides

Defined in:
lib/kete_translatable_content/extensions/tagging_controller_overrides.rb

Overview

for ITEM_CLASSES when new version is created to just add tags we want to update the version attribute of translations that matched previous version to new version number

Instance Method Summary collapse

Instance Method Details

#after_tags_added(options) ⇒ Object

method that add-ons can define to do something after tags added



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/kete_translatable_content/extensions/tagging_controller_overrides.rb', line 9

def after_tags_added(options)
  logger.debug("what are after_tags added options: " + options.inspect)
  # get translations matching starting version
  translations = @item.class::Translation.all(@item.class.as_foreign_key_sym => @item.id,
                                              :version => options[:starting_version].to_s)

  translations.each do |t|
    t.version = options[:ending_version].to_s
    t.save!
  end
end