运行rake db:migrate时出现错误:uninitialized constant WickedPdf
。rake db:migrate - 未初始化的常量WickedPdf
我已按照此页上列出的说明https://github.com/mileszs/wicked_pdf/issues/53关于如何安装WickedPdf。
我可以运行在命令行的wkhtmltopdf二进制和我wicked_pdf.rb看起来是这样的:
WickedPdf.config = {
:exe_path => '/usr/local/bin/wkhtmltopdf'
}
这里是我的宝石名单以供参考:
$ bundle exec gem list
*** LOCAL GEMS ***
actionmailer (2.3.14)
actionpack (2.3.14)
activerecord (2.3.14)
activeresource (2.3.14)
activesupport (2.3.14)
brightbox (2.3.9)
bundler (1.3.5)
capistrano (2.14.2)
highline (1.6.16)
hoe (3.5.2)
hpricot (0.8.2)
htmldoc (0.2.3)
json (1.7.7)
macaddr (1.6.1)
mysql (2.9.1)
net-scp (1.1.0)
net-sftp (2.1.1)
net-ssh (2.6.7)
net-ssh-gateway (1.2.0)
paginator (1.1.1)
rack (1.1.6)
rails (2.3.14)
rake (10.0.4)
rdoc (4.0.1)
RedCloth (4.2.9)
rmagick (2.13.1)
systemu (2.5.2)
uuid (2.0.2)
will_paginate (2.3.16)
wkhtmltopdf-binary (0.9.9.1)
感谢
您是否尝试在迁移中创建PDF?您是否在该迁移文件中添加了“require wicked_pdf”? – 2013-04-20 18:15:23
@JesseWolgamott据我所知没有,不是我的应用程序,所以我不能确定。无论如何,我认为迁移只是针对数据库的? – 2013-04-20 19:25:09
您所遵循的链接并未指定如何在Rake任务中使用'WickedPdf'。您可能已将WickedPdf正确添加到您的Rails应用程序中,但这并不一定意味着您的自定义Rake任务已知道“WickedPdf”。尝试下面的@ alfonso的解决方案,它应该工作。 – 2013-07-18 00:38:23