我已经为我的Rails应用程序安装了CKeditor,在进行格式化时,格式化代码没有显示在屏幕上,而是呈现HTML,就像这样
<h2><strong>In this project</strong> you’ll create a simple blog system and learn the basics of Ruby on Rails including: Models, Views, and Controllers (MVC) Data Structures & 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’s especially true in starting up a project. Rails practices the idea of "sensible defaults" 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>
答案 0 :(得分:2)
使用html_safe
方法
所以,比如:
puts my_variable.html_safe
此处有更多信息:http://yehudakatz.com/2010/02/01/safebuffers-and-rails-3-0/