html - Clearing the layout cache in a Rails application -
my application.html.slim
template looks conceptually:
/ stuff = header() / more stuff = yield / more stuff = footer()
now header()
, footer()
loaded external source , language-specific.
i have introduced language-change mechanism (based on url) header
, footer
loaded different source language changed.
my problem:
i start server i loadhttp://myserver.dev/en
the content header shown in english language --> ok i load http://myserver.dev/de
now header still in english language while content in high german --> not ok now header , footer won't alter until restart server again. so how can clear layout cache, footer
, header
re-loaded.
i tried next (to no avail):
manually removing cache files disk (they still seem in memory)adding next setting in application.rb
config.action_view.cache_template_loading = false config.action_controller.perform_caching = false
invoking rails.cache.clear
in every request attempting expire individual partial: expire_fragment('external/_header.html.slim')
or expire_fragment(%r{external})
i avoided situation using fragment cache , creating block cache each language.
in views define block alter language with:
<% cache("block_1_#{i18n.locale}") %> ... <% end %>
html ruby-on-rails caching ruby-on-rails-3.2
No comments:
Post a Comment