Module: Mobility::Plugins::ActiveModel::Dirty

Extended by:
Mobility::Plugin
Defined in:
lib/mobility/plugins/active_model/dirty.rb

Overview

Dirty tracking for models which include the ActiveModel::Dirty module.

Assuming we have an attribute title, this module will add support for the following methods:

  • title_changed?

  • title_change

  • title_was

  • title_will_change!

  • title_previously_changed?

  • title_previous_change

  • restore_title!

The following methods are also patched to work with translated attributes:

  • changed_attributes

  • changes

  • changed

  • changed?

  • previous_changes

  • clear_attribute_changes

  • restore_attributes

In addition, the following ActiveModel attribute handler methods are also patched to work with translated attributes:

  • attribute_changed?

  • attribute_previously_changed?

  • attribute_was

(When using these methods, you must pass the attribute name along with its locale suffix, so title_en, title_pt_br, etc.)

Other methods are also included for ActiveRecord models, see documentation on the ActiveRecord dirty plugin for more information.

Defined Under Namespace

Modules: BackendMethods, InstanceMethods Classes: HandlerMethodsBuilder, MobilityMutationTracker

Method Summary

Methods included from Mobility::Plugin

configure, configure_default, default, dependencies, dependencies_satisfied?, included, included_hook, initialize_hook, requires