Open
Description
Hey,
im having an issue after upgrading from Rails 4.2 to Rails 5.2.2.
My setup:
class PagesController < ApplicationController
caches_action :show, layout: false, expires_in: 1.day
def show
@page = Page.find_by(...)
@rendered = render_to_string :inline => @page.content, :type => 'erb', :layout => false
end
end
<%= raw @rendered %>
Explanation: It loads some ERB HTML from db and renders it.
After the upgrade to 5.2.2 the first cold response includes the contents of @rendered
html-escaped which leads to an unpleasant result because the user sees the page as pure html text.
The log output looks like this:
I, [2019-03-26T14:46:44.352243 #10012] INFO -- : Processing by PagesController#show as HTML
I, [2019-03-26T14:46:44.352300 #10012] INFO -- : Parameters: {"lang"=>"en", "permalink"=>"contact"}
I, [2019-03-26T14:46:44.354388 #10012] INFO -- : Rendering inline template
I, [2019-03-26T14:46:44.354847 #10012] INFO -- : Rendered inline template (0.4ms)
I, [2019-03-26T14:46:44.355110 #10012] INFO -- : Rendering pages/show.html.erb
I, [2019-03-26T14:46:44.355191 #10012] INFO -- : Rendered pages/show.html.erb (0.0ms)
I, [2019-03-26T14:46:44.356112 #10012] INFO -- : Rendering html template within layouts/application
I, [2019-03-26T14:46:44.356174 #10012] INFO -- : Rendered html template within layouts/application (0.0ms)
the following warm responses contain the unescaped @rendered
content and the log looks like this (with fine results):
I, [2019-03-26T14:46:48.135881 #10012] INFO -- : Processing by PagesController#show as HTML
I, [2019-03-26T14:46:48.135915 #10012] INFO -- : Parameters: {"lang"=>"en", "permalink"=>"contact"}
I, [2019-03-26T14:46:48.136769 #10012] INFO -- : Rendering html template within layouts/application
I, [2019-03-26T14:46:48.136827 #10012] INFO -- : Rendered html template within layouts/application (0.0ms)
And finally a log output with disabled action_cache (with fine results):
I, [2019-03-26T14:53:38.090452 #12603] INFO -- : Processing by PagesController#show as HTML
I, [2019-03-26T14:53:38.090505 #12603] INFO -- : Parameters: {"lang"=>"en", "permalink"=>"contact"}
I, [2019-03-26T14:53:38.092181 #12603] INFO -- : Rendering inline template
I, [2019-03-26T14:53:38.095078 #12603] INFO -- : Rendered inline template (2.8ms)
I, [2019-03-26T14:53:38.095415 #12603] INFO -- : Rendering pages/show.html.erb within layouts/application
I, [2019-03-26T14:53:38.095500 #12603] INFO -- : Rendered pages/show.html.erb within layouts/application (0.0ms)
Metadata
Metadata
Assignees
Labels
No labels