Sinatra: Template engine not found: prawn

2019-08-08 21:16发布

I'm a newbie with Sinatra and prawn. I succeeded with erb and xmm/builder templates. Now trying to get pdf generation with prawn working.

Error received: Template engine not found: prawn

Code:

require 'rubygems'
require 'sinatra'
require 'sinatra/prawn'

set :prawn, { :page_layout => :portrait }

get '/pdf' do
  content_type 'application/pdf'
  prawn :pdf1
end

Thanks.

标签: sinatra prawn
1条回答
在下西门庆
2楼-- · 2019-08-08 21:44

Found it: The gem from sbfaulkner doesn't work with current version of Sinatra.

Fix: install the forked gem from danielberkompas as follows:

gem install dberkom-sinatra-prawn -s http://gems.github.com

See issue 6

Then the above code works fine.

查看更多
登录 后发表回答