Class: Redundancy::UpdateBase
- Inherits:
-
Object
- Object
- Redundancy::UpdateBase
- Defined in:
- lib/redundancy/update_base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#change_if ⇒ Object
readonly
Returns the value of attribute change_if.
-
#dest ⇒ Object
readonly
Returns the value of attribute dest.
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
- #after_save(record) ⇒ Object
-
#before_save(record) ⇒ Object
ActiveRecord Hooks.
- #force_update!(record) ⇒ Object
-
#initialize(options) ⇒ UpdateBase
constructor
A new instance of UpdateBase.
Constructor Details
#initialize(options) ⇒ UpdateBase
Returns a new instance of UpdateBase.
8 9 10 11 12 13 14 15 16 |
# File 'lib/redundancy/update_base.rb', line 8 def initialize @options = @klass = [:klass] @source, @dest = [:source], [:dest] @change_if = [:change_if] @update = [:update] || false cleanup_context end |
Instance Attribute Details
#change_if ⇒ Object (readonly)
Returns the value of attribute change_if.
5 6 7 |
# File 'lib/redundancy/update_base.rb', line 5 def change_if @change_if end |
#dest ⇒ Object (readonly)
Returns the value of attribute dest.
5 6 7 |
# File 'lib/redundancy/update_base.rb', line 5 def dest @dest end |
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
5 6 7 |
# File 'lib/redundancy/update_base.rb', line 5 def klass @klass end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/redundancy/update_base.rb', line 4 def @options end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
5 6 7 |
# File 'lib/redundancy/update_base.rb', line 5 def source @source end |
Instance Method Details
#after_save(record) ⇒ Object
26 27 |
# File 'lib/redundancy/update_base.rb', line 26 def after_save record end |
#before_save(record) ⇒ Object
ActiveRecord Hooks
23 24 |
# File 'lib/redundancy/update_base.rb', line 23 def before_save record end |
#force_update!(record) ⇒ Object
18 19 20 |
# File 'lib/redundancy/update_base.rb', line 18 def force_update! record set_context :force, true end |