expiring an action cache
mzaragoza opened this issue · 4 comments
I added this to my project and its working fine but I am having a problem expiring the cache
my controller looks like
class PostsController < ApplicationController
caches_action :show
def show
@post = Post.find(params[:id])
end
end
it works fine when I visit different post but when a post gets updated it does not reflect that
Thanks
@mzaragoza you are right, the documentation of this gem is not complete. You have to use a so called Sweeper.
Have a look at the rails-observers README.
Можно обновлять так:
expire_action controller: "posts", action: "show"
Но данный метод не работает из другого контроллера!
Может кто подскажет как его вызвать из другого контроллера?
@zedtux
rails-observers is not working for rails 5.. end mongoid
👍 It would be nice to have a cache_key type of control over the expiration of the cache at the controller level.