Class: Mobility::ActiveModel::BackendResetter
- Inherits:
-
BackendResetter
- Object
- Module
- BackendResetter
- Mobility::ActiveModel::BackendResetter
- Defined in:
- lib/mobility/active_model/backend_resetter.rb
Overview
Backend resetter for ActiveModel models. Adds hook to reset backend when changes_applied
or clear_changes_information
methods are called on model.
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(attributes) { ... } ⇒ BackendResetter
constructor
A new instance of BackendResetter.
Methods inherited from BackendResetter
Constructor Details
#initialize(attributes) { ... } ⇒ BackendResetter
Returns a new instance of BackendResetter.
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/mobility/active_model/backend_resetter.rb', line 12 def initialize(attributes) super model_reset_method = @model_reset_method %i[changes_applied clear_changes_information].each do |method| define_method method do super() instance_eval &model_reset_method end end end |