1

我已经为我的 Rails 应用程序安装了 CKeditor,在进行格式化时,格式化后的代码不会显示在屏幕上,而是呈现 HTML,就像这样

<h2><strong>In this project</strong> you&rsquo;ll create a simple blog system and learn the basics of Ruby on Rails including: Models, Views, and Controllers (MVC) Data Structures &amp; Relationships Routing Migrations Views with forms, partials, and helpers RESTful design Using Rails plugins/gems The project will be developed in five iterations. I0: Up and Running Part of the reason Ruby on Rails became popular quickly is that it takes a lot of the hard work off your hands, and that&rsquo;s especially true in starting up a project. Rails practices the idea of &quot;sensible defaults&quot; and will, with one command, create a working application ready for your customization. Setting the Stage First we need to make sure everything is set up and installed. See the Environment Setup page for instructions on setting up and verifying your Ruby, Rails, and add-ons. This tutorial was created with Rails 4.0.0, and may need slight adaptations for other versions of Rails. Let us know if you find something strange! From the command line, switch to the folder that will store your projects. For instance, I use /Users/jcasimir/projects/. Within that folder, run the rails command:</h2>
4

1 回答 1

2

使用html_safe方法

所以,像:

puts my_variable.html_safe

更多信息在这里:http: //yehudakatz.com/2010/02/01/safebuffers-and-rails-3-0/

于 2013-09-29T11:32:14.453 回答