我正在尝试设置PDFKit,但我甚至无法运行我的应用程序。我一直收到这个错误:
`require': cannot load such file -- pdfkit (LoadError)
这是我的整个application.rb文件。
require File.expand_path('../boot', __FILE__)
require 'rails/all'
require 'pdfkit'
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require(*Rails.groups(:assets => %w(development test)))
# If you want your assets lazily compiled in production, use this line
#Bundler.require(:default, :assets, Rails.env)
end
module Form
class Application < Rails::Application
# Configure the default encoding used in templates for Ruby 1.9.
config.encoding = "utf-8"
# Configure sensitive parameters which will be filtered from the log file.
config.filter_parameters += [:password]
# Enable the asset pipeline
config.assets.enabled = true
# Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0'
config.middleware.use PDFKit::Middleware
end
end
我已按照wiki页面上的pdfkit说明进行操作,但我遇到了这个错误。我认为它找不到pdfkit gem但似乎已经安装了。请帮忙。
答案 0 :(得分:2)
从application.rb
中删除require 'pdfkit'
添加到您的Gemfile
gem "pdfkit"
然后从rails root目录运行bundle
命令。