2010-11-17 70 views

回答

0

如果您在ApplicationController中使用before_filter以防止客户进入页面,则可以在DedicatedController的基础控制器中使用skip_filter

所以对于我们的,我们有:

class ApplicationController 
    before_filter :ensure_not_a_customer 
    . 
    . 
end 
class Admin::BaseController < ApplicationController 
    skip_filter :ensure_not_a_customer 
    . 
    . 
end 
class Admin::WebpageController < Admin::BaseController 
    . 
    . 
end 

然后从任何管理员继承:: BaseController将跳过从ApplicationController中的的before_filter。

相关问题