module RailsCoreExtensions::Translations::ClassMethods
Public Instance Methods
base_translation_class()
click to toggle source
# File lib/rails_core_extensions/translations.rb, line 16 def base_translation_class return base_class if defined?(ActiveRecord) && ancestors.include?(ActiveRecord::Base) self end
t(key, options = {})
click to toggle source
# File lib/rails_core_extensions/translations.rb, line 21 def t(key, options = {}) self.translate(key, options) end
translate(key, options = {})
click to toggle source
# File lib/rails_core_extensions/translations.rb, line 8 def translate(key, options = {}) I18n.translate key, **options.merge(scope: translation_key) end
translation_key()
click to toggle source
# File lib/rails_core_extensions/translations.rb, line 12 def translation_key @translation_key ||= base_translation_class.name.tableize.singularize.gsub('/', '.') end