未初始化的常量ActionController :: Caching :: Sweeping(NameError)

时间:2016-04-06 10:30:01

标签: ruby-on-rails ruby actioncontroller

它是一个基于api的应用程序

使用rails 4.1.13

gem' rails-observers'

应用程序/配置/初始化/ base_sweeper.rb

class BaseSweeper < ActionController::Caching::Sweeper
  observe ActiveRecord::Base

  def after_save(object)
    # ..... call to version class for record saving purpose
  end

end

application.rb中

config.autoload_paths += %W(#{config.root}/services #{config.root}/lib)

应用程序/服务/ version.rb

class Version
  #some method to store records
end

ChannelController.rb

classs Api::V1::ChannelsController < Api::V1::BaseController
 cache sweeper :base_sweeper, only: [:create, :update]
end

#channel.rb
has_many :channel_logs

#channel_log.rb
belongs_to :channel

development.rb
config.active_record.observers = :base_sweeper

我得到了一个错误未初始化的恒定基地?

0 个答案:

没有答案