diff --git a/lib/mobility.rb b/lib/mobility.rb index a49952c5f..b578c3971 100644 --- a/lib/mobility.rb +++ b/lib/mobility.rb @@ -38,7 +38,9 @@ class VersionNotSupportedError < ArgumentError; end class << self def extended(model_class) - model_class.extend Translates + def model_class.translates(*args, **options) + include Mobility.translations_class.new(*args, **options) + end end # Extends model with this class so that +include Mobility+ is equivalent to @@ -177,17 +179,6 @@ def set_locale(locale) end end - module Translates - # Includes translated attributes on model class. - # @!method translates(*attributes, **options) - # @param [Array] attributes - # @param [Hash] options - # @yield Yields to block with backend as context - def translates(*args, **options) - include Mobility.translations_class.new(*args, **options) - end - end - class InvalidLocale < I18n::InvalidLocale; end class NotImplementedError < StandardError; end end diff --git a/lib/mobility/translations.rb b/lib/mobility/translations.rb index bc52d918f..8303feb3a 100644 --- a/lib/mobility/translations.rb +++ b/lib/mobility/translations.rb @@ -7,9 +7,9 @@ module Mobility Module containing translation accessor methods and other methods for accessing translations. -Normally this class will be created by calling -{Mobility::Translates#translates}, which is a class method on any model that -extends {Mobility}, but it can also be used independent of that macro. +Normally this class will be created by calling +translates+ on the model class, +added when extending {Mobility}, but it can also be used independent of that +macro. ==Including Translations in a Class