forked from rubygarage/boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 1
Macro::ModelDestroy
Vladislav Trotsenko edited this page Oct 21, 2020
·
1 revision
Provides to destroy last model in chain.
class SomeOperation < ApplicationOperation
step ->(ctx, **) { ctx[:some_model] = SomeModel.create }
step Macro::ModelDestroy(path: %i[some_model]) # ctx[:some_model].destroy
endclass SomeOperation < ApplicationOperation
step ->(ctx, **) { ctx[:some_model] = SomeModel.create }
step Macro::ModelDestroy(path: %i[some_model some_relation]) # ctx[:some_model].some_relation.destroy
end