Module: Mobility::ActiveModel::AttributeMethods

Defined in:
lib/mobility/active_model/attribute_methods.rb

Overview

Included into model if model has ActiveModel::AttributeMethods among its ancestors.

Instance Method Summary collapse

Instance Method Details

#attributesArray<String>

Adds translated attributes to attributes.

Returns:

  • (Array<String>)

    Model attributes



14
15
16
# File 'lib/mobility/active_model/attribute_methods.rb', line 14

def attributes
  super.merge(translated_attributes)
end

#translated_attributesArray<String>

Translated attributes defined on model.

Returns:

  • (Array<String>)

    Translated attributes



20
21
22
23
24
# File 'lib/mobility/active_model/attribute_methods.rb', line 20

def translated_attributes
  translated_attribute_names.inject({}) do |attributes, name|
    attributes.merge(name.to_s => send(name))
  end
end