Module: TaggingOverrides
- Included in:
- AudioRecording, Comment, Document, StillImage, Topic, Video, WebLink
- Defined in:
- lib/kete_translatable_content/extensions/tagging_overrides.rb
Overview
Redefines public_tags and private_tags to translate the returned tag objects Make sure these are only done when the class they are being included into already responds to public_tags, otherwise it’ll end up trying to alias a method that doesn’t exist
Class Method Summary collapse
Class Method Details
.included(klass) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/kete_translatable_content/extensions/tagging_overrides.rb', line 7 def self.included(klass) klass.class_eval do if self.new.respond_to?(:public_tags) alias_method(:public_tags_orig, :public_tags) unless self.new.respond_to?(:public_tags_orig) def Tag.swap_in_translation_for_multiple() end end if self.new.respond_to?(:private_tags) alias_method(:private_tags_orig, :private_tags) unless self.new.respond_to?(:private_tags_orig) def Tag.swap_in_translation_for_multiple() end end end end |