2011-10-04 50 views
0

我有一個Rails 3應用程序,我正在使用Prawn來生成PDF文件。對蝦0.11.1不支持rails 3.0.9

我已經在我的控制器中定義的:

Class DocumentosController < ApplicationController 
    def show 
     @documento = Documento.find(params[:id]) 
     prawnto :prawn => { 
      :left_margin => 20, 
      :right_margin => 20 
     } 
    end 
end 

在我看來,我有這樣的:

<p><%= link_to "Download", documento_path(@docmento, :format => "pdf") %></p> 

在application.rb中我有這樣的:

config.gem "prawn" 

我得到:

NoMethodError in DocumentosController#show 
undefined method 'prawnto' for #<DocumentosController:0xb6e99358> 

我嘗試重新安裝gem,但問題仍然存在,如果我嘗試/documentos/6.pdf例如該gem生成PDF,但文件有錯誤。

任何想法,這是問題嗎?

感謝您的幫助。

+0

您是否解決了您的問題?我有同樣的問題 – inye

回答

0

Rails 3使用bundler爲了要求寶石。因此,您必須將蝦添加到您的Gemfile中,然後運行bundle install

+0

我做過,但我遇到同樣的問題。 – chelofm

+0

你想使用它嗎? http://railscasts.com/episodes/153-pdfs-with-prawn如果是,你也必須將插件添加到你的gem文件中... – lucapette