我有一个带有 Article 模型的 Rails3 应用程序。
管理员登录后,只需转到 article/show 方法即可查看“未授权”的文章:
if !@article.is_authorized and !user_signed_in?
raise ActionController::RoutingError.new('Not Found')
end
我想从授权的那一刻起缓存文章。在管理员审查它们时,如何防止它们被缓存?
如何在操作中放置如下代码?
if @article.is_authorized
cache_action
or cache_fragment
or whatever