无法在Rails应用程序中更新我的视图页面

时间:2014-09-23 10:12:09

标签: ruby-on-rails ruby caching view browser-cache

如何解决此问题。请教我如何解决这个问题....

首先,我曾尝试在我的网络应用上使用网页缓存。但是,它并没有很好地运行。那不太好。所以,我更新了摆脱页面缓存。之后,我的应用程序的页面缓存视图页面无法更新。

下面是我的config / environment / development.rb

KaguShop::Application.configure do
  # Settings specified here will take precedence over those in config/application.rb.

  # In the development environment your application's code is reloaded on
  # every request. This slows down response time but is perfect for development
  # since you don't have to restart the web server when you make code changes.
  config.cache_classes = false

  # Do not eager load code on boot.
  config.eager_load = false

  # Show full error reports and disable caching.
  config.consider_all_requests_local       = true
  config.action_controller.perform_caching = false

  # Don't care if the mailer can't send.
  config.action_mailer.raise_delivery_errors = false

  # Print deprecation notices to the Rails logger.
  config.active_support.deprecation = :log

  # Raise an error on page load if there are pending migrations
  config.active_record.migration_error = :page_load

  # Debug mode disables concatenation and preprocessing of assets.
  # This option may cause significant delays in view rendering with a large
  # number of complex assets.
  config.assets.debug = true

  #caching for objects
  #config.cache_store = :mem_cache_store
end

然后,在我编辑了缓存设置后,我尝试了这个命令 ※当然,我重新打开浏览器。

rails console
Rails.cache.clear

2 个答案:

答案 0 :(得分:1)

在浏览器上尝试ctrl+shift+delete以清除cache

执行缓存config.action_controller.perform_caching应设置为 true

在更新之前,您必须执行expire_page :action => action_name

之类的操作

例如:

  def update
       expire_page :action => profile
       ...........
  end

我在其他地方收集了有关缓存的信息。检查他们herehere

答案 1 :(得分:0)

OMG ....
这就是这个问题的答案 我不知道这个导轨的结构......
After removing caches_page cached sites are still not updated