Module: ActiveVersion::Adapters::ActiveRecord::Translations::ClassMethods
- Defined in:
- lib/active_version/adapters/active_record/translations.rb
Instance Method Summary collapse
-
#has_translations(options = {}) ⇒ Object
Declare that a model has translations.
Instance Method Details
#has_translations(options = {}) ⇒ Object
Declare that a model has translations
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/active_version/adapters/active_record/translations.rb', line 13 def has_translations( = {}) include ActiveVersion::Translations::HasTranslations # Store options ActiveVersion.registry.register(self, :translations, ) # Register translation class translation_class_name = "#{name}Translation" if const_defined?(translation_class_name) translation_class = const_get(translation_class_name) if [:table_name] && translation_class.respond_to?(:table_name=) translation_class.table_name = [:table_name].to_s end ActiveVersion.registry.register_version_class(self, :translations, translation_class) end end |