ckeditor 和 Rails 3 应用程序。格式化文本未按应有的方式显示

发布于 2024-12-14 03:04:56 字数 986 浏览 2 评论 0原文

我正在使用 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&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>

这就是结果,正如您所看到的,文本周围有标签,但它们被转义了。 感谢您抽出时间。

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

秋日私语 2024-12-21 03:04:56

好的。我得到了它。我只需要在球场前的原料。例如 <%= [电子邮件受保护] %>

<%= 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 :).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文