module Pathway::Plugins::SequelModels::DSLMethods
Public Instance Methods
after_commit(step_name = nil, &bl)
click to toggle source
# File lib/pathway/plugins/sequel_models.rb, line 23 def after_commit(step_name = nil, &bl) fail 'must provide a step or a block but not both' if !step_name.nil? == block_given? if step_name after_commit { step step_name } else around(-> steps, state { dsl = self.class::DSL.new(State.new(self, state.to_h.dup), self) db.after_commit do steps.call(dsl) end }, &bl) end end
transaction(step_name = nil, &bl)
click to toggle source
# File lib/pathway/plugins/sequel_models.rb, line 9 def transaction(step_name = nil, &bl) fail 'must provide a step or a block but not both' if !step_name.nil? == block_given? if step_name transaction { step step_name } else around(-> steps, _ { db.transaction(savepoint: true) do raise Sequel::Rollback if steps.call.failure? end }, &bl) end end