ckeditor 和 Rails 3 应用程序。格式化文本未按应有的方式显示
我正在使用 Rails 3 的 ckeditor,并且已经在表单中设置了它,除了视图部分之外,效果很好,当我转到模型显示页面时,我标记了我用于文本格式化的标签,但没有粗体字体或任何其他修改我对文字做了。问题出在哪里?我是否必须像在表单中那样在呈现此文本的字段旁边放置一些内容?
工作正常的表单代码
<div class="field">
<%= f.cktext_area :comments, :cols => 80, :rows => 20 %>
</div>
在 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’s an SUV for buyers who like to be noticed, but who also need the
capabilities of a full-sized truck-based SUV – and are willing to pay to get them.
</em>
这就是结果,正如您所看到的,文本周围有标签,但它们被转义了。 感谢您抽出时间。
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’s an SUV for buyers who like to be noticed, but who also need the
capabilities of a full-sized truck-based SUV – 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的。我得到了它。我只需要在球场前的原料。例如
<%= [电子邮件受保护] %>
或<%= raw(car.comments) %>
取决于您需要它们的位置。感谢谷歌:)。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 :).