wicked_pdf无法呈现pdf 500错误

时间:2013-02-19 09:38:23

标签: ruby-on-rails macos wicked-pdf

我无法让wicked_pdf在Mac OSX 10.8.2,Ruby 1.9.2,Rails 3.2.11上本地工作

如果有任何人有任何分享此事的智慧,请做。

在我的Gemfile中,我有:

gem "wicked_pdf"

group :development do
  gem "wkhtmltopdf"
  gem "wkhtmltopdf-binary"
  ...
end

group :production do
  gem "wkhtmltopdf-heroku"
end

我的控制器中有以下内容:

def show
  ...
  respond_to do |format|
  format.html
  format.pdf do
    render :pdf => 'filename',
           :handlers => [:haml]
    end
  end
end

在我看来,我有这个链接:

= link_to 'Create PDF document', consultant_path(@consultant, :format => :pdf)

点击后会获得相同的网址,并在其末尾添加.pdf。

这是从日志输出的内容。

Started GET "/profiler/user1.pdf" for 127.0.0.1 at 2013-02-19 10:23:12 +0100
Processing by ConsultantsController#show as PDF
  Parameters: {"id"=>"user1"}
  Consultant Load (0.3ms)  SELECT "consultants".* FROM "consultants" WHERE"consultants"."slug" = 'user1' LIMIT 1

User Load (0.2ms)  SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1
CACHE (0.0ms)  SELECT "consultants".* FROM "consultants" WHERE "consultants"."slug" = 'user1' LIMIT 1
***************WICKED***************
Rendered consultants/show.pdf.haml (34.3ms)
Rendered text template (0.0ms)
Completed 500 Internal Server Error in 57ms (Views: 3.2ms | ActiveRecord: 0.5ms)

似乎恶人在某种程度上工作但渲染失败了?

0 个答案:

没有答案