Hi!
The blog post introducing dry-transaction 0.10 gives an example of how to build a base class to use for one’s own transactions. There are a couple of problems:
- typo:
self.inherited
should bedef self.inherited
- The new base class’
call
ends up higher up in the ancestors list than the includedDry::Transaction
module, so it is never invoked.
In sum, this is what I had to do:
class MyTransactionBase
module InstanceMethods
def call(input, wrapper_class = nil)
# custom stuffz
super(input)
end
end
def self.inherited(klass)
klass.send :include, Dry::Transaction
klass.send :prepend, InstanceMethods
end
end
Not sure if this should be filed as a bug. If not, maybe the blog post could be updated?
Or maybe I misunderstood something?
Anyway—thanks for dry-rb! It’s changing the way we write code at my job.