与 ckeditor 集成,不显示 images-wicked-pdf

Integration with ckeditor, isnt showing the images-wicked-pdf

所以,我从 ckeditor 加载图像,当我渲染 html 时,它不显示,没有错误出现,只是一个空白方块,而不是图像,我尝试了原始,html_safe,但是没有解决,我输入的文字显示正常,有没有人知道为什么会这样?

一张图片在

https://user-images.githubusercontent.com/26804018/31889194-ae1084e8-b7dd-11e7-85c7-1ba09d946269.png

在我看来:

<h6><b>1. Objetivo:</b></h6>
<p><%= raw @pop.objective %></p>

我的控制器:

def show
    # redirect_to :index_pdf
    # @pop = Pop.friendly.find(params[:id])
    @pop = Pop.find(params[:id])
   pdf = render pdf: @pop.title,
           :layout => false,
           template: "pops/index_pdf.html.erb",
           locals: {:pop => @pop},
           header: { 
                      right: 'Pág. [page] de [topage].' 
                    }
                    # send_file(pdf, :filename => @pop.title+'.pdf')
                    # baixar automaticamente
                    # precisa fazer 
  end

我的模特:

has_attached_file :image, styles: { medium: "300x300>" }, default_url: "/images/default.png"

我通过添加辅助方法解决了:

def with_abs_path(htmlstring)
   htmlstring.to_s.gsub(/(href|src)=(['"])\/([^\"']*|[^"']*)['"]/, '=' + 'address_of_server' + '')
end

并打电话查看我的 pdf:

<%= raw with_abs_path(@pop.objective) %>

视图是相同的显示:

<%= raw @pop.objective %>