Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/60.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 仅偶尔调用_filter之后的Rails_Ruby On Rails_Refinerycms - Fatal编程技术网

Ruby on rails 仅偶尔调用_filter之后的Rails

Ruby on rails 仅偶尔调用_filter之后的Rails,ruby-on-rails,refinerycms,Ruby On Rails,Refinerycms,我正试图建立一个宝石自动发送清洗我的清漆 特定精炼CMS引擎的服务器。为了做到这一点,我决定 不适用于清扫器,但适用于过滤器之后 奇怪的是,after过滤器只是偶尔被调用 我使用的是refinerycms 0.9.9.15,代码如下: require 'refinerycms-pages' module RefinerycmsPagePurging def self.included(base) base.class_eval do after_filter :purg

我正试图建立一个宝石自动发送清洗我的清漆 特定精炼CMS引擎的服务器。为了做到这一点,我决定 不适用于清扫器,但适用于过滤器之后

奇怪的是,after过滤器只是偶尔被调用

我使用的是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
需要“精炼CMS页面”
模块细化CMSPAGEPURGING
def自带(基本)
基本类\u评估do
过滤:清除页面后,:only=>[:创建,:更新,:销毁]
_filter:purge_all之后,:only=>[:update_positions]
受保护的
def清除所有
Rails.logger.info“***清除所有”
结束
def清除页面
Rails.logger.info“***清除页面”
结束
结束
结束
结束
类Railtie

知道我做错了什么吗?

似乎是config.after\u初始化导致的。我不能用来做准备,因为到那时精炼CMS还没有完全设置好,它抱怨缺少控制器的粗糙方法。查看refinerycms核心初始化,我发现了一个回调refinery.after\u包含,我可以用它代替config.to\u prepare。这似乎使它工作!我还不得不从使用铁轨转向使用发动机。