Module: Mobility::Plugins::Sequel::Dirty
- Defined in:
- lib/mobility/plugins/sequel/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.
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/mobility/plugins/sequel/dirty.rb', line 19 def write(locale, value, = {}) locale_accessor = Mobility.normalize_locale_accessor(attribute, locale).to_sym if model.column_changes.has_key?(locale_accessor) && model.initial_values[locale_accessor] == value super [model.changed_columns, model.initial_values].each { |h| h.delete(locale_accessor) } elsif read(locale, .merge(fallback: false)) != value model.will_change_column(locale_accessor) super end end |