I'm updating a site from rails 4.2 to 5.1
In the previous setup I have page caching on a generated stylesheet (per tenant), all working perfectly.
After upgrading to 5.1 this is no longer working
Using latest version of actionpack-page_caching
Controller for the Stylesheet that is cached looks like this:
class StylesheetsController < ApplicationController
caches_page :show, gzip: true
def show
@stylesheet = Stylesheet.find(params[:id])
respond_to do |format|
format.html
format.css { render text: @stylesheet.contents, content_type: "text/css" }
end
end
end
I'm getting the following error in the logs:
ActionView::MissingTemplate - Missing template stylesheets/show, application/show with {:locale=>[:en], :formats=>[:css], :variants=>[], :handlers=>[:raw, :erb, :html, :builder, :ruby]}. Searched in:
There is no physical template for this as I'm rendering it directly from the stylesheet model. Have confirmed the model is returning data.
Caching is enabled in development.
In the layout page the reference to the dynamic stylesheet is:
<link href="<%= dynamic_stylesheet %>.css" rel="stylesheet" type="text/css" />
and the helper method (in application_helper) is:
def dynamic_stylesheet
stylesheet_path(current_account.stylesheet) unless current_account&.stylesheet&.id.nil?
end
I'm not sure what's getting skipped/missed here, any pointers?