我正在将我的应用程序从Rails 3.0升级到Rails 3.1.
在可能的情况下,我已经将旧插件分类为有利于宝石,其中包括用这个漂亮闪亮的新prawnto_2宝石替换旧的prawnto插件.
大多数事情似乎很好,但我不能像以前一样加载图像.我的PDF视图中的代码是
pdf.image open("#{RAILS_ROOT}/public/images/logo.png")
Run Code Online (Sandbox Code Playgroud)
但是我收到以下错误
uninitialized constant ActionView::CompiledTemplates::RAILS_ROOT
Run Code Online (Sandbox Code Playgroud)
我意识到图像文件的位置会随着我使用资源而改变,并且图像不再存储在公共文件夹中.