rendering stored html tag from database to view

Hi All,

  I upgrading my old rails application with new rails version 3.0.1 , In
my old application i stored html tagged data(i.e <p> i am paragraph
tagged word </p>) in database(i.e mysql) and i renderd the html tagged
data in view means. The browser detect the html tag and generate the
relevent view of data string (i.e i am paragraph tagged word)

Controller:

Hi All,

I upgrading my old rails application with new rails version 3.0.1 , In
my old application i stored html tagged data(i.e <p> i am paragraph
tagged word </p>) in database(i.e mysql) and i renderd the html tagged
data in view means. The browser detect the html tag and generate the
relevent view of data string (i.e i am paragraph tagged word)

Controller:

 @test=Text\.find\(1\)

View:

&lt;div&gt;Text from database: &lt;span style=&quot;xxxx&quot;&gt;&lt;%\.\.\.@test\.word%&gt; &lt;/span&gt;

Expected output in browser:

  Text from database:  i am paragraph tagged word

Note: It is working fine in rails 2.3.8

Result output in browser for rails 3.0.1:

Text from database: &lt;p&gt; i am paragraph tagged word &lt;/p&gt;

Why i didn't get the html result generated output in rails 3.0.1
Corrector suggest me what went wrong ?

Rails escapes your html for you these days, and by default it will
assume that a piece of text of unknown provenance is not safe and so
will escape it.
You can either use the raw view helper or call html_safe on the string
itself, ie

<%= raw some_method_returning_html %> or <%
some_method_returning_html.html_safe %>

Fred

Frederick Cheung wrote in post #963584: