0

I've recently shifted my old Rails 2.3.2 system to Rails 3.1. My issue is that after the upgrade, all my HTML content -- outputted through <%= @page.content %> -- now comes out as escaped characters rather than the raw HTML content.

How can I fix this?

1 Answer 1

3

Starting from rails 3.X you get auto-escaped strings. If you want to put raw HTML in your views use something like this:

<%= raw @page.content %>
Sign up to request clarification or add additional context in comments.

4 Comments

I knew it would be something like this. Thanks!
:D welcome. It happened all the time to me when I was migrating some application from 2.x to 3.x :)
In Rails 3 you can also use @page.content.html_safe.
Yep I know but I prefer the raw call. It declares more clearer what it's going on IMHO :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.