Skip to content

Commit f5931b6

Browse files
authored
Merge pull request #57 from robzolkos/fix-rails-6
Fix for Rails 6 Mime lookups
2 parents 7bddaff + d962342 commit f5931b6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/action_controller/caching/pages.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,13 @@ def cache_page(content = nil, options = nil, gzip = Zlib::BEST_COMPRESSION)
275275
request.path
276276
end
277277

278-
if (type = Mime::LOOKUP[self.content_type]) && (type_symbol = type.symbol).present?
278+
type = if self.respond_to?(:media_type)
279+
Mime::LOOKUP[self.media_type]
280+
else
281+
Mime::LOOKUP[self.content_type]
282+
end
283+
284+
if type && (type_symbol = type.symbol).present?
279285
extension = ".#{type_symbol}"
280286
end
281287

0 commit comments

Comments
 (0)