I think the easiest solution would be to define a forem for monkey-patch to add your own declarations:
class Forem::Ability
alias_method :orig_init, :initialize
def initialize(user)
orig_init(user)
end
end
class Ability < Forem::Ability; end
If in the context of the engine, the method can?should use a controller / namespace to authorize actions ( Forem::Ability), when your own controller is used in your own application context and there is no namespace to do the same.
So I think this solution here (which will add all the authorization actions to both Ability, and to Forem::Ability, should solve your problem.
UPDATE: I now understand that the engine controller method current_abilityprobably reads something like:
def current_ability
@current_ability ||= Forem::Ability.new(current_user)
end
And your (by default from cancan stone) reads something like:
def current_ability
@current_ability ||= Ability.new(current_user)
end
, , , , , .