我在wysiwyg編輯器(ckeditor)中上傳內聯圖像。它與Paperclip集成。 但是,當我生成pdf時,ckeditor的圖像不顯示。 我在做什麼錯?rails ckeditor和wicked_pdf
下面的代碼:
attachment_file.rb:
class Ckeditor::AttachmentFile < Ckeditor::Asset
has_attached_file :data,
:url => "/ckeditor_assets/attachments/:id/:filename",
:path => ":rails_root/public/ckeditor_assets/attachments/:id/:filename"
validates_attachment_presence :data
validates_attachment_size :data, :less_than => 100.megabytes
do_not_validate_attachment_file_type :data
def url_thumb
@url_thumb ||= Ckeditor::Utils.filethumb(filename)
end
end
controller.rb:
def download
html = render_to_string("offer_template_one", :formats => [:html], :layout => "templates.html")
pdf = WickedPdf.new.pdf_from_string(html)
send_data(pdf,
:filename => "offer.#{@offer.id}.pdf",
:disposition => 'attachment')
end
application.rb中:
config.assets.paths << Rails.root.join("app", "assets", "fonts")
config.assets.precompile += %w(templates.css)
config.autoload_paths += %W(#{config.root}/app/models/ckeditor)
的圖片上傳裏面的CKEditor是s成公共/ ckeditor_assets /圖片
謝謝!