tl;tr;
create a module and define the method
include it after the gem
check it by self.class.ancestors
to see the inheritance chain (ηΆζΏγγ§γΌγ³)
π€ Situation
class PointsController < ApplicationController
include MyModule
include Banken
def index
banken_user #=> current_user π€
end
end
module MyModule
def banken_user
# custom curent_user
end
end
# gem
module Banken
def banken_user
current_user
end
end
Enter fullscreen mode
Exit fullscreen mode
π 解決
class PointsController < ApplicationController
+ include Banken
include MyModule
- include Banken
def index
banken_user #=> custome current_user π
end
end
Enter fullscreen mode
Exit fullscreen mode
π Parent Note
Top comments (0)