Skip to content

Commit

Permalink
Fix typo in UPGRADING.md
Browse files Browse the repository at this point in the history
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
  • Loading branch information
HashNotAdam committed Nov 22, 2023
1 parent 0237135 commit fa76a3d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**
Expand Down

0 comments on commit fa76a3d

Please sign in to comment.