Open aldesantis opened 8 years ago
Could you write a test to expose this issue?
I can confirm inheritance doesn't work on hooks. Any update on the fix?
@aandis There are no updates on this from maintainers. But just yesterday, we solved this problem at our company using the method mentioned in the PR description (using inherited
hooks) and it works well :)
Here is a test case:
require 'interactor'
class ABC
include Interactor
around :do_it
def do_it(interactor)
p "doing it"
interactor.call
p "done it"
end
end
class DoIt < ABC
def call
p "calling DoIt"
end
end
DoIt.call
class DoItAgain < ABC
around :do_it
def call
p "calling DoItAgain"
end
end
DoItAgain.call
Output:
"calling DoIt"
"doing it"
"calling DoItAgain"
"done it"
Expected Output:
"doing it"
"calling DoIt"
"done it"
"doing it"
"calling DoItAgain"
"done it"
Gemfile used:
source "https://rubygems.org"
gem "interactor"
+1, still an issue on the latest version 😕
Still an issue 7 years later...
I'm rewriting my API layer to use interactors and I noticed callbacks defined on an interactor are not inherited by its children. Is this the desired behavior?
For the moment, this works fine: