Module: TranslationCms::Taggable
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/translation_cms/taggable.rb
Instance Method Summary collapse
- #cached_meta_tags ⇒ Object
-
#meta_tag(attr_name, options = {}) ⇒ Object
Save meta tags records into one hash.
Instance Method Details
#cached_meta_tags ⇒ Object
30 31 32 |
# File 'lib/translation_cms/taggable.rb', line 30 def @cached_meta_tags ||= {} end |
#meta_tag(attr_name, options = {}) ⇒ Object
Save meta tags records into one hash
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/translation_cms/taggable.rb', line 18 def (attr_name, = {}) key = (attr_name) pure_key, locale = .match(key)[1..2] locale ||= I18n.locale key = locale == I18n.default_locale ? pure_key : [pure_key, locale || I18n.locale].join('_') [key] ||= .detect { |t| t.name == key } [key] ||= .build(name: key) if [:build] [key] end |