Module: EmbeddedLocalization::ActiveRecord::ClassMethods
- Defined in:
- lib/embedded_localization/active_record/class_methods.rb
Instance Method Summary collapse
-
#fallbacks? ⇒ Boolean
# determine if we are using fallbacks.
-
#translated?(name) ⇒ Boolean
Checks whether field with given name is translated field.
-
#translated_attributes ⇒ Object
Returns Array of Symbols for all attributes of this class, which have translations through acts_as_i18n.
Instance Method Details
#fallbacks? ⇒ Boolean
# determine if we are using fallbacks
20 21 22 23 |
# File 'lib/embedded_localization/active_record/class_methods.rb', line 20 def fallbacks? i18n_fallbacks = I18n.backend.class.included_modules.map(&:to_s).include?('I18n::Backend::Fallbacks') # will be true if config.i18n.fallbacks => true in config i18n_fallbacks || [:fallbacks] == true end |
#translated?(name) ⇒ Boolean
Checks whether field with given name is translated field. Param String or Symbol Returns true or false
15 16 17 |
# File 'lib/embedded_localization/active_record/class_methods.rb', line 15 def translated?(name) translated_attribute_names.include?(name.to_sym) end |
#translated_attributes ⇒ Object
Returns Array of Symbols for all attributes of this class,
which have translations through acts_as_i18n.
returns an Array of Symbols
8 9 10 |
# File 'lib/embedded_localization/active_record/class_methods.rb', line 8 def translated_attributes translated_attribute_names end |