Module Baz
def foo
super
:baz
end
end
Class A
prepend Baz
def foo
:bar
end
end
A.new.foo //works fine
now if I transform my module to Concern module, it's not...
module BazConcern
extend ActiveSupport::Concern
included do
def foo
super
:baz
end
end
end
So how can we use prepend with ActiveSupport::Concern ? with ruby 2+
prependwithActiveSupport::Concern(Rails 6.1+)Rails 6.1 added support of
prependwithActiveSupport::Concern.Please, see the following example:
It is also worth to mention that
concerningis also updated:Sources:
A link to the corresponding commit.
Rails allows a module with extend ActiveSupport::Concern to be prepended.
prepend and concerning docs.