我有一个很大的问题,我无法弄清楚。
我试图在显示操作中生成一个页面:
# 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://localhost:3000/projects/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/ruby-1.8.7-p352@linhadefrente/gems/jquery-rails-1.0.14/vendor/assets/javascripts, /Users/victorrodrigues/Sites/ror/linhadefrente/app/assets/fontface, /Users/victorrodrigues/Sites/ror/linhadefrente/public/system
我尝试添加“系统”路径:
# application.rb
config.assets.paths << "#{Rails.root}/public/system"
但是我不知道如何解决这个问题,有人可以帮忙吗?谢谢