妖兽PDF +回形针

林有一个巨大的问题,那我不能弄明白。

我试着去产生一个show动作页面:

# projects_controller.rb def show @project = Project.find(params[:id]) respond_to do |format| format.html format.pdf do render :pdf => "#{@project.id}-#{@project.name}", :template => 'projects/show.pdf.erb', :layout => 'layouts/pdf.html.erb', :encoding => "utf-8", :show_as_html => params[:debug].present? end end end

但是,这种观点我已经通过一些回形针上传的文件,当我尝试输入http://本地主机:3000 /项目/次数1.pdf例如,它抛出一个错误:

Sprockets::FileOutsidePaths in Projects#show Showing /Users/victorrodrigues/Sites/ror/linhadefrente/app/views/projects/show.pdf.erb where line #342 raised: /system/upload/platforms/14/icon/small/revista.png?2011 isn't in paths: /Users/victorrodrigues/Sites/ror/linhadefrente/app/assets/fontface, /Users/victorrodrigues/Sites/ror/linhadefrente/app/assets/images, /Users/victorrodrigues/Sites/ror/linhadefrente/app/assets/javascripts, /Users/victorrodrigues/Sites/ror/linhadefrente/app/assets/stylesheets, /Users/victorrodrigues/Sites/ror/linhadefrente/vendor/assets/stylesheets, /Users/victorrodrigues/.rvm/gems/[email protected]/gems/jquery-rails-1.0.14/vendor/assets/javascripts, /Users/victorrodrigues/Sites/ror/linhadefrente/app/assets/fontface, /Users/victorrodrigues/Sites/ror/linhadefrente/public/system

我trye​​d添加了“系统”的路径:

# application.rb config.assets.paths << "#{Rails.root}/public/system"

但我不知道如何解决这个问题,任何人都可以帮忙吗? 谢谢

--------------解决方案-------------

这似乎是一个宝石不兼容的问题。

尝试gem "sprockets", "2.0"

参见更多详细信息链接。

如果你已经有链轮2.0或更高,而你感动保存你指的是该文件的文件夹(例如我搬到从JavaScript的资产我的模板文件夹),它可能只是一个缓存的问题。 我重新启动我的计算机和它工作得很好。

分类:Ruby on Rails的 时间:2015-03-16 人气:9
分享到:

相关文章

Copyright (C) 55228885.com, All Rights Reserved.

55228885 版权所有 京ICP备15002868号

processed in 2.723 (s). 10 q(s)