Module: Mobility::Plugins::Dirty

Defined in:
lib/mobility/plugins/dirty.rb

Overview

Note:

Dirty tracking can have unexpected results when combined with fallbacks. A change in the fallback locale value will not mark an attribute falling through to that locale as changed, even though it may look like it has changed. See the specs for details on expected behavior.

Dirty tracking for Mobility attributes. See class-specific implementations for details.

Class Method Summary collapse

Class Method Details

.apply(attributes, option) ⇒ Object

Applies dirty plugin to attributes for a given option value.

Parameters:

  • attributes (Attributes)
  • option (Boolean)

    Value of option

Raises:

  • (ArgumentError)

    if model class does not support dirty tracking


28
29
30
31
32
33
# File 'lib/mobility/plugins/dirty.rb', line 28

def apply(attributes, option)
  if option
    FallthroughAccessors.apply(attributes, true)
    include_dirty_module(attributes.backend_class, attributes.model_class, *attributes.names)
  end
end