Sha256: d36d022015f89e8524ae2653eb8f005be591f1de64fb69b653a52548f9cc5f45

Contents?: true

Size: 784 Bytes

Versions: 1

Compression:

Stored size: 784 Bytes

Contents

# Because Rails' FileStore doesn't Marshal data
rails_ver = Rails.respond_to?(:version) ? Rails.version : Rails::VERSION::STRING
if rails_ver == '2.1.0'

  module ActiveSupport
    module Cache
      class FileStore < Store
        attr_reader :cache_path

        def read(name, options = nil)
          super
          File.open(real_file_path(name), 'rb') { |f| Marshal.load(f) } rescue nil
        end

        def write(name, value, options = nil)
          super
          ensure_cache_path(File.dirname(real_file_path(name)))
          File.atomic_write(real_file_path(name), cache_path) { |f| Marshal.dump(value, f) }
        rescue => e
          logger.error "Couldn't create cache directory: #{name} (#{e.message})" if logger
        end
      
      end
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
acts_as_recommendable-0.0.2 lib/cache_fix.rb