8
私は(フォームの送信には、PDFが邪悪なPDFの宝石を使用して生成されることになっている)私のフォームを送信しようとすると、私はこのエラーを取得しています -初期化されていない一定のMIME :: PDF/Railsの3プロジェクト
NameError in PostsController#create
uninitialized constant Mime::PDF
Rails.root: /Users/fkhalid2008/littlechits
Application Trace | Framework Trace | Full Trace
app/controllers/posts_controller.rb:42:in `create'
app/controllers/posts_controller.rb:39:in `create'
どうすればこの問題を解決できますか?関連するコードは以下の通りです。
POSTS CONTROLLER
def create
@post = Post.new(params[:post])
@post.user = current_user
respond_to do |format|
if verify_recaptcha && @post.save
format.html { redirect_to :action=> "index"}
format.pdf do
render :pdf => "file_name"
end
else
format.html { render :action => "new" }
format.json { render :json => @post.errors, :status => :unprocessable_entity }
end
end
end
CONFIG /初期化子/ WICKED_PDF.RB
# config/initializers/wicked_pdf.rb
WickedPdf.config = {
:exe_path => '/usr/local/bin/wkhtmltopdf'
}
おかげで、
ファイサルは