From fa76a3dc0ae64055eb75e699ac5e7819fb85eeb2 Mon Sep 17 00:00:00 2001 From: Adam Rice Date: Wed, 22 Nov 2023 10:58:42 +1100 Subject: [PATCH] Fix typo in UPGRADING.md When referring to how to escape HTML tags, the documentation forgot to call the `content` method. When using `html_safe`, an exception will be raised because `html_safe` is not defined on `Propshaft::Asset`. Using `raw`, on the other hand, will call `to_s` on the `Propshaft::Asset` instance, returning an expected tag --- UPGRADING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/UPGRADING.md b/UPGRADING.md index 8f5b1c1..2609807 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -253,8 +253,8 @@ Rails.application.assets.load_path.find('logo.svg').content As Rails escapes html tags in views by default, in order to output a rendered svg you will need to specify rails not to escape the string using [html_safe](https://api.rubyonrails.org/classes/String.html#method-i-html_safe) or [raw](https://api.rubyonrails.org/classes/ActionView/Helpers/OutputSafetyHelper.html#method-i-raw). ```ruby -Rails.application.assets.load_path.find('logo.svg').html_safe -raw Rails.application.assets.load_path.find('logo.svg') +Rails.application.assets.load_path.find('logo.svg').content.html_safe +raw Rails.application.assets.load_path.find('logo.svg').content ``` **Precompilation in development**