Module: Mobility::Plugins::ActiveModel::Dirty
- Included in:
- Mobility::Plugins::ActiveRecord::Dirty
- Defined in:
- lib/mobility/plugins/active_model/dirty.rb
Defined Under Namespace
Classes: MethodsBuilder
Backend Accessors collapse
-
#write(locale, value, options = {}) ⇒ Object
Updates translation for provided locale without calling backend's methods to persist the changes.
Instance Method Details
#write(locale, value, options = {}) ⇒ Object
Updates translation for provided locale without calling backend's methods to persist the changes.
30 31 32 33 34 35 36 37 38 |
# File 'lib/mobility/plugins/active_model/dirty.rb', line 30 def write(locale, value, = {}) locale_accessor = Mobility.normalize_locale_accessor(attribute, locale) if model.changed_attributes.has_key?(locale_accessor) && model.changed_attributes[locale_accessor] == value model.attributes_changed_by_setter.except!(locale_accessor) elsif read(locale, .merge(fallback: false)) != value model.send(:attribute_will_change!, locale_accessor) end super end |