大家好,我正在尝试在rails 4中使用邪恶的pdf .
我按照这个页面https://github.com/mileszs/wicked_pdf .
我做了:
gem install wicked pdf
然后我尝试了命令
rails g wicked_pdf
### And got "Could not find the generator"
我正在尝试导出视图
请有人帮我配置wicked_pdf吗?
大家好,我正在尝试在rails 4中使用邪恶的pdf .
我按照这个页面https://github.com/mileszs/wicked_pdf .
我做了:
gem install wicked pdf
然后我尝试了命令
rails g wicked_pdf
### And got "Could not find the generator"
我正在尝试导出视图
请有人帮我配置wicked_pdf吗?
3 回答
一些东西
首先,你需要将
gem 'wicked_pdf'
和gem 'wkhtmltopdf-binary'
放在Gemfile
并运行bundle install
第二,根据文档而不是
你应该进入
你当然需要指定一些路径!所以在你的 config/initializers/wicked_pdf.rb 中请添加(或取消注释)这个:
以及你的控制器:
最近发生了同样的问题
rails generate wicked_pdf Running via Spring preloader in process 28540 **Could not find generator 'wicked_pdf'**. Maybe you meant 'scaffold', 'helper' or 'mailer'
要么
分辨率很简单 . 确保在安装gem之后重新加载Spring gem .
这个时刻在gem文档中几乎没有涉及,因为Spring在Rails 5.2中是默认的