Ruby on Rails:清除缓存的页面 [英] Ruby on Rails: Clear a cached page

查看:913
本文介绍了Ruby on Rails:清除缓存的页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个RoR应用程序(ruby v1.8.7; rails v2.3.5),该应用程序在开发环境中缓存页面。这并不是什么大问题,但是缓存页面的 a 元素是不正确的。



我没有



我尝试清除浏览器(Firefox 3.5),但没有对development.rb文件进行任何更改,也没有向控制器添加任何缓存命令。



OSX上的Cookie和该站点(本地主机)的页面缓存。我还重新启动了Mongrel。似乎没有什么帮助。



我缺少什么?

解决方案

  config.action_controller.perform_caching = false 


您可以使用

 <$清除Rails缓存c $ c> Rails.cache.clear 

说-我不相信这是一个缓存问题。您是否正在对该页面进行更改,而没有看到它们的反映?您可能不是在查看该页面的实时版本?我已经做了一次(脸红)。



更新:



您可以在控制台中调用该命令。
您确定要在开发中运行该应用程序吗?



唯一的选择是,您要呈现的页面不是被渲染。



如果您观看服务器输出,则应该在页面呈现时类似于以下内容看到render命令:

 渲染的shared_pa​​rtials / _latest_featured_video(31.9ms)
渲染的shared_pa​​rtials / _s_invite_friends(2.9ms)
渲染的布局/ _sidebar(2002.1ms)
渲染layouts / _footer(2.8ms)
渲染的layouts / _busy_indicator(0.6ms)


I have a RoR application (ruby v1.8.7; rails v2.3.5) that is caching a page in the development environment. This wouldn't be so much of an issue, but the cached page's a elements are incorrect.

I haven't made any changes to the development.rb file and I haven't knowingly added any caching commands to the controllers.

I've tried clearing the browser's (Firefox 3.5 on OSX) cookie and page caches for this site (localhost). I've also restarted Mongrel. Nothing seems to help.

What am I missing?

解决方案

This line in development.rb ensures that caching is not happening.

config.action_controller.perform_caching             = false

You can clear the Rails cache with

Rails.cache.clear

That said - I am not convinced this is a caching issue. Are you making changes to the page and not seeing them reflected? You aren't perhaps looking at the live version of that page? I have done that once (blush).

Update:

You can call that command from in the console. Are you sure you are running the application in development?

The only alternative is that the page that you are trying to render isn't the page that is being rendered.

If you watch the server output you should be able to see the render command when the page is rendered similar to this:

Rendered shared_partials/_latest_featured_video (31.9ms)
Rendered shared_partials/_s_invite_friends (2.9ms)
Rendered layouts/_sidebar (2002.1ms)
Rendered layouts/_footer (2.8ms)
Rendered layouts/_busy_indicator (0.6ms)

这篇关于Ruby on Rails:清除缓存的页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆