Module: SoMeta::Helper
- Defined in:
- lib/so_meta/helper.rb
Instance Method Summary collapse
Instance Method Details
#so_meta(name, scope = nil) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/so_meta/helper.rb', line 3 def (name, scope = nil) interpolation_data = instance_variable_get("@so_meta_#{name}_interpolation") || {} request_key = "so_meta.#{controller_path.gsub(/\//, "_")}.#{action_name}" if scope.present? begin return I18n.translate!("#{request_key}.#{scope}.#{name}") rescue I18n::MissingTranslationData nil end end t("#{request_key}.#{name}", interpolation_data.merge(default: t("so_meta.defaults.#{name}"))) end |
#so_meta_interpolation(name, hash) ⇒ Object
19 20 21 |
# File 'lib/so_meta/helper.rb', line 19 def (name, hash) instance_variable_set("@so_meta_#{name}_interpolation", hash) end |