我正在使用 rails_admin 来为我的 Post 模型创建所见即所得的编辑器,这基本上只是博客文章。我有一个内容字段和标题字段。
我还包括了 ckeditor 以格式化内容字段的文本。我试图在我的视图中显示每个帖子,如下所示:
<% @posts.each do |post| %>
<div class="row text">
<%= post.title %>
<%= post.content %>
</div>
<% end %>
但是,当内容显示在屏幕上时,会打印出由 ckeditor 添加到内容中的所有 html 标签。例如,如果我增加了文本的大小,或者将句子设为粗体或斜体,它将打印出所有的 html 和 css 代码。
我希望能够让 html 呈现到我的 erb 文件中,以便在用户的视图中自动格式化。
当我查看检查器时,内容用引号括起来。
我的 railsadmin 配置文件这样调用 Post 模型:
config.model Post do
edit do
field :title
field :content, :ck_editor
end
end
谢谢你。