Class: ViewModel::ActiveRecord::UpdateContext::ReleaseEntry
- Inherits:
-
Struct
- Object
- Struct
- ViewModel::ActiveRecord::UpdateContext::ReleaseEntry
- Defined in:
- lib/view_model/active_record/update_context.rb
Instance Attribute Summary collapse
-
#association_data ⇒ Object
Returns the value of attribute association_data.
-
#viewmodel ⇒ Object
Returns the value of attribute viewmodel.
Instance Method Summary collapse
- #claimed! ⇒ Object
- #claimed? ⇒ Boolean
-
#initialize ⇒ ReleaseEntry
constructor
A new instance of ReleaseEntry.
- #release! ⇒ Object
Constructor Details
#initialize ⇒ ReleaseEntry
Returns a new instance of ReleaseEntry.
9 10 11 12 |
# File 'lib/view_model/active_record/update_context.rb', line 9 def initialize(*) super @claimed = false end |
Instance Attribute Details
#association_data ⇒ Object
Returns the value of attribute association_data
8 9 10 |
# File 'lib/view_model/active_record/update_context.rb', line 8 def association_data @association_data end |
#viewmodel ⇒ Object
Returns the value of attribute viewmodel
8 9 10 |
# File 'lib/view_model/active_record/update_context.rb', line 8 def viewmodel @viewmodel end |
Instance Method Details
#claimed! ⇒ Object
24 25 26 |
# File 'lib/view_model/active_record/update_context.rb', line 24 def claimed! @claimed = true end |
#claimed? ⇒ Boolean
28 29 30 |
# File 'lib/view_model/active_record/update_context.rb', line 28 def claimed? @claimed end |
#release! ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/view_model/active_record/update_context.rb', line 14 def release! model = viewmodel.model case association_data.direct_reflection.[:dependent] when :delete, :delete_all model.delete when :destroy, :destroy_async model.destroy end end |