我有一个 Rails 问题,定义如下:
module MyConcern
extend ActiveSupport::Concern
included do
before_filter :filter_inside_concern
end
def filter_inside_concern
# ...
end
end
我before_filter
在控制器层也有一个:
class MyController < ApplicationController
before_filter :filter_inside_controller
end
如果我包含MyConcern
inside MyController
,调用 before 过滤器的顺序是否取决于代码的排列方式?例如,如果我们有
class MyController < ApplicationController
include MyConcern
before_filter :filter_inside_controller
end
之前是否filter_inside_concern
被调用filter_inside_controller
(反之亦然)?
谢谢!