【发布时间】:2009-12-24 10:36:43
【问题描述】:
我的应用程序控制器如下所示
class ApplicationController < ActionController::Base
include AuthenticatedSystem
helper :all # include all helpers, all the time
protect_from_forgery # :secret => 'sup3rs3cr3t'
filter_parameter_logging :password
# Here's the interesting bit
before_filter :login_required, :except => [:index, :show, :new]
end
现在我有了另一个看起来像这样的控制器
class CompletelySecretController < ApplicationController
# the other interesting bit
before_filter :login_required
def index
@secrets = Secret.find(:all)
end
end
我仍然可以看到所有的秘密,尽管我声明所有操作都需要登录
before_filter :login_required
认为子类中的before_filter覆盖父类中的before_filter是不是很直观?
【问题讨论】:
标签: ruby-on-rails ruby inheritance oop