Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ckeditor and rails 3 app. formatted text not displaying as it should be

I am using ckeditor for rails 3 and I have it set up already in form, works nice except the view part, when I go to the model show page I tags that I used for text formatting but there is no bold font or any other modifications I did to the text. Where is the problem? Do I have to put something next to the field that is rendering this text like I did in form?

code for form that works just fine

<div class="field">
  <%= f.cktext_area :comments, :cols => 80, :rows => 20 %>
</div>

and in show.html.erb

<p style="margin-left:5px;text-align:justify;padding:5px;"><%= @car.comments %></p>


    <p> <em>The 2011 Cadillac Escalade ranks 1 out of 9 Luxury Large SUVs. This ranking is 
based on our analysis of 86 published reviews and test drives of the Cadillac Escalade, and 
our analysis of reliability and safety data.The 2011 Cadillac Escalade is not for shrinking 
violets. It&rsquo;s an SUV for buyers who like to be noticed, but who also need the 
capabilities of a full-sized truck-based SUV &ndash; and are willing to pay to get them. 
</em>

That is the result, as you see there are tags around the text but they are escaped. Thanks for your time.

like image 512
rmagnum2002 Avatar asked Dec 12 '22 08:12

rmagnum2002


1 Answers

OK. I got it. I just needed the raw before the field. for example <%= [email protected] %> or

<%= raw(car.comments) %> depending where you need them. Thanks to Google :).

like image 91
rmagnum2002 Avatar answered Dec 30 '22 09:12

rmagnum2002