Html剥离出白色空格.

Tra*_*der 0 html ruby ruby-on-rails erb ruby-on-rails-3

这有点傻.我使用Rails作为我的网络应用程序.它使用如下语句从数据库中获取数据

<div class="show-content"> <%= @page.content %> </div>
Run Code Online (Sandbox Code Playgroud)

一个示例html输出相同.

<div class="show-content">
Migrations are a convenient way for you to alter your database in a structured and organized manner.

Active Record tracks which migrations have already been run so all you have to do is update your source and run rake db:migrate. 

Migrations also allow you to describe these transformations using Ruby. 
</div>
Run Code Online (Sandbox Code Playgroud)

如您所见,它们由3个段落组成.但是当它们被显示时,新线(空格)被剥离,这不是我想要的.我应该创建一个帮助器还是有一个内置函数来做到这一点?

dKe*_*Ken 5

尝试使用simple_format()HTML规则转换输入.TextHelper#simple_format文档