开发者

How can I disable layout file caching (Rails 2)?

开发者 https://www.devze.com 2023-03-08 09:31 出处:网络
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'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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号