I'm trying to upgrade to rails 4 beta 1, but I've a bit of a problem.
This is, in short, how my application controller looks like.
class ApplicationController < ApplicationController
caches_action :method
end
caches_action
is moved out to it's own gem in Rails 4, so including the gem should fix the problem.
gem "actionpack-action_caching", github: "rails/actionpack-action_caching"
But when I run my requests specs or visit the application in a browser I get this error.
app/controllers/application_controller.rb:3:in `<class:ApplicationController>': undefined method `caches_action' for ApplicationController:Class (NoMethodError)
Why is that?
As the caching is not a part of core anymore, you need to explicitly require it in top of every file you use it in:
require 'actionpack/action_caching'
The problem is in Rails 4, they have extracted cache part into separate gems
if you are getting error for action caching then you need to add below gem
gem 'actionpack-action_caching'
for page caching have to add
gem 'actionpack-page_caching'
I also played around then I figure out that, have not added gem to do the same.
hope that will works. Thank you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With