当我从继承控制器(如 UsersController < ApplicationController)调用位于 ApplicationController 中的方法时,该方法的范围是什么?应用控制器还是用户控制器?
假设我有这些文件
class ApplicationController < ActionController::Base
def method1
method2
end
def method2
...
end
end
class UsersController < ApplicationController
# call method1 from here
def method2
...
end
end
正如您在此处看到的,我从 UsersController 调用 method1(位于 appcontroller 中);method1 会调用位于 UsersController 内还是 ApplicationController 内的 method2?
谢谢!