Sha256: 8a9a1c59ceb6b5506063f4067247af6c5619144864eb82789fcdd753bf972b4f

Contents?: true

Size: 1023 Bytes

Versions: 31

Compression:

Stored size: 1023 Bytes

Contents

# frozen_string_literal: true

module Mobility
  module Plugins
=begin

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

@see Mobility::Plugins::ActiveModel::Dirty
@see Mobility::Plugins::ActiveRecord::Dirty
@see Mobility::Plugins::Sequel::Dirty

@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.

=end
    module Dirty
      extend Plugin

      default true

      requires :backend, include: :before
      requires :fallthrough_accessors

      initialize_hook do
        if options[:dirty] && !options[:fallthrough_accessors]
          warn 'The Dirty plugin depends on Fallthrough Accessors being enabled, '\
            'but fallthrough_accessors option is falsey'
        end
      end
    end

    register_plugin(:dirty, Dirty)
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
mobility-1.3.1 lib/mobility/plugins/dirty.rb
mobility-1.3.0 lib/mobility/plugins/dirty.rb
mobility-1.3.0.rc3 lib/mobility/plugins/dirty.rb
mobility-1.3.0.rc2 lib/mobility/plugins/dirty.rb
mobility-1.3.0.rc1 lib/mobility/plugins/dirty.rb
mobility-1.2.9 lib/mobility/plugins/dirty.rb
mobility-1.2.8 lib/mobility/plugins/dirty.rb
mobility-1.2.7 lib/mobility/plugins/dirty.rb
mobility-1.2.6 lib/mobility/plugins/dirty.rb
mobility-1.2.5 lib/mobility/plugins/dirty.rb
mobility-1.2.4 lib/mobility/plugins/dirty.rb
mobility-1.2.3 lib/mobility/plugins/dirty.rb
mobility-1.2.2 lib/mobility/plugins/dirty.rb
mobility-1.2.1 lib/mobility/plugins/dirty.rb
mobility-1.2.0 lib/mobility/plugins/dirty.rb
mobility-1.1.3 lib/mobility/plugins/dirty.rb
mobility-1.1.2 lib/mobility/plugins/dirty.rb
mobility-1.1.1 lib/mobility/plugins/dirty.rb
mobility-1.1.0 lib/mobility/plugins/dirty.rb
mobility-1.0.7 lib/mobility/plugins/dirty.rb