简体   繁体   English

Forem gem无法显示图像

[英]Images not being displayed by Forem gem

I am new to rails. 我是新手。 Currently I am working on developing a forum with Forem gem on rails 4.1.5. 目前,我正在与Forem gem在Rails 4.1.5上开发一个论坛。 I am using CKEditor with Forem. 我将CKEditor与Forem一起使用。 In Forem when I upload an image it is not displayed in the output, although it is saved (as i can see the image in the editor when i click on edit). 在Forem中,当我上传图像时,尽管已保存,但它并未显示在输出中(因为我单击编辑时可以在编辑器中看到该图像)。

Doing inspect element I found that the image tag is not present in the output. 在检查元素时,我发现输出中不存在image标签。 I have tried to search but have not found any solution. 我尝试搜索,但未找到任何解决方案。 The only discussion I was able to get was this: https://github.com/radar/forem/issues/428 我唯一能得到的讨论是: https : //github.com/radar/forem/issues/428

I am using CKEditor in an other part of my app where the images are being stored and displayed. 我在应用程序的另一部分使用CKEditor来存储和显示图像。 I only find this issue in the Forem. 我只在Forem中找到此问题。 How can i get the images to be displayed? 如何获取要显示的图像?

I ran into the same problem. 我遇到了同样的问题。 To fix it, I edited /app/views/forem/posts/_post.html.erb and changed this line: 要解决此问题,我编辑了/app/views/forem/posts/_post.html.erb并更改了以下行:

<%= forem_format(post.text) %> 

to instead look like: 相反看起来像:

<%= post.text.html_safe %>

When I made this change, the images displayed. 当我进行此更改时,将显示图像。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM