igor-alexandrov / wisepdf

Wkhtmltopdf wrapper done right
MIT License
281 stars 20 forks source link

Template is missing #14

Closed mairon closed 11 years ago

mairon commented 11 years ago

hi, Igor,

my controller

def relatorio_financas
@financas = Financa.relatorio_financas(params) @financas_anterior = Financa.relatorio_financas_saldo_anterior(params) respond_to do |format| format.html format.pdf { render :pdf => "relatorio_financas" } end end

error Template is missing

Missing template financas/relatorio_financas with {:locale=>[:en], :formats=>[:pdf], :handlers=>[:erb, :builder]}. Searched in: * "/home/mairon/projetos/zetta/app/views"

because he shall not find the format?

igor-alexandrov commented 11 years ago

Can you show me contents of /home/mairon/projetos/zetta/app/views/financas/relatorio_financas, please?

Igor Alexandrov ––––––––––––––––––––––––––––––––––––––– +7 (910) 531-6049 igor.alexandrov@gmail.com skype: alexandrov-igor –––––––––––––––––––––––––––––––––––––––

On Tuesday, November 27, 2012 at 8:27 PM, MaironBrasil wrote:

hi, Igor,
my controller
def relatorio_financas

@financas = Financa.relatorio_financas(params) @financas_anterior = Financa.relatorio_financas_saldo_anterior(params) respond_to do |format| format.html
format.pdf { render :pdf => "relatorio_financas" } end end
error Template is missing
Missing template financas/relatorio_financas with {:locale=>[:en], :formats=>[:pdf], :handlers=>[:erb, :builder]}. Searched in: * "/home/mairon/projetos/zetta/app/views" because he shall not find the format?

— Reply to this email directly or view it on GitHub (https://github.com/igor-alexandrov/wisepdf/issues/14).

mairon commented 11 years ago

is simple content

<% if params[:moeda].to_s == '1'%> <% else %> <% end %>
Anterior : <%= number_to_currency(anterior, :format=>' %n ', :precision => 0)%> <%= number_to_currency(subentrada, :format=>' %n ', :precision => 0) %> <%= number_to_currency(subsaida, :format=>' %n ', :precision => 0) %> <%= number_to_currency(anterior.to_f + subentrada.to_f - subsaida.to_f , :format=>' %n ', :precision => 0) %>Anterior : <%= number_to_currency(anterior, :format=>' %n ', :separeitor => ',')%> <%= number_to_currency(subentrada, :format=>' %n ', :separeitor => ',') %> <%= number_to_currency(subsaida, :format=>' %n ', :separeitor => ',') %> <%= number_to_currency(anterior.to_f + subentrada.to_f - subsaida.to_f , :format=>' %n ', :separeitor => ',') %>
mairon commented 11 years ago

hello, I'm full of passing a url parameter

http://localhost:3000/financas/relatorio_financas.pdf?utf8=%E2%9C%93&filtro=1&inicio=01%2F01%2F2010&final=20%2F04%2F2012&cheque=&busca%5Bconta%5D=1&moeda=0&tipo=0

igor-alexandrov commented 11 years ago

I mean content of a directory. Like:

cd  /home/mairon/projetos/zetta/app/views/financas/relatorio_financas
ls -la
mairon commented 11 years ago

cd /home/mairon/projetos/zetta/app/views/financas

drwxr-xr-x 2 mairon mairon 4096 Nov 28 17:48 . drwxr-xr-x 80 mairon mairon 4096 Nov 27 12:15 .. -rwxr-xr-x 1 mairon mairon 209 Set 20 2010 edit.html.erb -rw-r--r-- 1 mairon mairon 3026 Nov 27 12:19 extrato_bancario.html.erb -rwxr-xr-x 1 mairon mairon 2105 Nov 27 12:19 index.html.erb -rw-r--r-- 1 mairon mairon 3312 Nov 14 12:13 _lanz_futuros_extrac_bc.html.erb -rwxr-xr-x 1 mairon mairon 171 Set 20 2010 new.html.erb -rwxr-xr-x 1 mairon mairon 6567 Nov 28 17:28 relatorio_financas.html.erb

igor-alexandrov commented 11 years ago

To create PDFs you should add relatorio_financas.pdf.erb, or use one template for both html and pdf, then you should remove html part from template name: relatorio_financas.erb.

mairon commented 11 years ago

Perfect.. Thanks