【问题标题】:Can't update my view pages at Rails application无法在 Rails 应用程序中更新我的视图页面
【发布时间】:2014-09-24 00:08:26
【问题描述】:

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

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

下面是我的配置/环境/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

【问题讨论】:

  • 你使用pow rack server等吗?
  • 配置更改后您是否重新加载了服务器?
  • 不,我只使用 WEBrick
  • View 中的缓存方法呢?- 你删除了吗?
  • 我的缓存方法是“caces_page”。我已经删除了它。

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


【解决方案1】:

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

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

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

例如:

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

前几天我在 2 个地方收集了有关缓存的信息。检查他们herehere

【讨论】:

  • 我不想使用缓存。但它在我的应用程序上仍然有效。那么,我该如何解决呢?
  • 您的应用中是否添加了任何翻译?
【解决方案2】:

天啊....
这就是这个问题的答案。
我不知道这个rails的结构...
After removing caches_page cached sites are still not updated

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-03-29
    • 2017-09-16
    • 2013-06-23
    • 1970-01-01
    • 2021-03-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多