简体   繁体   中英

Rails controller inheritance

Say I have controller X which inherits from controller Y:

class X < YController

and my YController inherits from ApplicationController.

Would I still have access to all methods/classes via my X controller that are available in the ApplicationController?

Yes, you will. All methods will be inherited unless you override them in the child controller. Remember that Rails controllers are just Ruby classes and you will get the same inheritance behavior that you get with any other Ruby class.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM