Skip to content

Instantly share code, notes, and snippets.

@kamiller
Last active December 20, 2015 13:09
Show Gist options
  • Save kamiller/6136974 to your computer and use it in GitHub Desktop.
Save kamiller/6136974 to your computer and use it in GitHub Desktop.
rails erb escape html

Use raw(string), as described in the release notes.

7.4.3 Other Changes

You no longer need to call h(string) to escape HTML output, it is on by default in all view templates. If you want the unescaped string, call raw(string).

Basically, where you did

<%=h @model.attr %>

before you can now use

<%= @model.attr %>

and where you did that before you can now use

<%=raw @model.attr %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment