Undefined caches_action method for ApplicationController: Class

I am trying to upgrade to rails 4 beta 1, but I have a little problem.

In short, what my application manager looks like.

class ApplicationController < ApplicationController
  caches_action :method
end

caches_action migrates to its own stone in Rails 4, so turning on the pearl should fix the problem.

gem "actionpack-action_caching", github: "rails/actionpack-action_caching"

But when I run my queries or visit the application in the browser, I get this error.

app/controllers/application_controller.rb:3:in `<class:ApplicationController>': undefined method `caches_action' for ApplicationController:Class (NoMethodError)

Why is this?

  • Rails 4.0.0.beta1
  • Ruby 2.0.0
  • Rspec 2.13.1
+5
source share
2 answers

Since caching is no longer part of the kernel, you need to explicitly indicate it at the top of each file in which you use it:

require 'actionpack/action_caching'
+11
source

Problem in Rails 4, they extracted part of the cache into individual gems

, gem

gem 'actionpack-action_caching'

gem 'actionpack-page_caching'

, , , .

, . .

+2

All Articles