Created
August 25, 2022 06:09
-
-
Save igaiga/3bff6f8eac414d42b126e014e6f145ae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ParentController | |
before_action :something_method | |
private | |
def something_method | |
"Parent" | |
end | |
end | |
class ChildController < ParentController | |
# before_actionは書かない | |
private | |
def something_method | |
# 親クラスの同名メソッドをのっとる | |
"Childd" | |
# 必要ならsuperで親クラスのメソッドも呼べる | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment