我正在尝试构建一个gem来自动发送清除到我的清漆 特定refinerycms引擎的服务器。为了做到这一点,我决定了 不要与扫地机一起工作,而是与after_filters合作。
奇怪的是,只是偶尔调用后过滤器!
我正在使用refinerycms 0.9.9.15,这是代码:
require 'refinerycms-pages'
module RefinerycmsPagePurging
def self.included(base)
base.class_eval do
after_filter :purge_pages, :only => [:create, :update, :destroy]
after_filter :purge_all, :only => [:update_positions]
protected
def purge_all
Rails.logger.info "*** Purge all"
end
def purge_pages
Rails.logger.info "*** Purge pages"
end
end
end
end
class Railtie < Rails::Railtie
config.after_initialize do
Admin::PagesController.send :include, RefinerycmsPagePurging
end
end
任何想法我做错了什么?