How can I disable layout file caching (Rails 2)?
I'm creating a custom CMS in Rails 2 that enables users to edit a web page using markdown. The page they are creati开发者_JS百科ng is within an iframe. An editor web page UI wraps that iframe.
I've found that this causes a problem in production because how Rails caches the layout file. The first time I load the editor it works as expected, but after I load a second editor page the editor uses the layout file for the page within the iframe and breaks the presentation of the editor.
In development or when config.cache_classes = false I don't see this problem.
Is there a way to either force a new layout to load for both the inner iframe and the outer editor page? Or is there a way to disable caching for this Controller's actions.
In researching this issue I've found that you can enable caching for specific actions in a controller with 'caches_action,' but there doesn't seem to be a way to turn off caching for isolated instances.
Thanks much.
You can always specify which layout to use in the action by using:
render :layout => 'layout_name'
See if the problem is solved by explicitly specifying the layout.
精彩评论