Welcome to Working With Rails

 

Discussion Forums

Discuss all things Ruby on Rails with perhaps the web's most vibrant group of Ruby on Rails enthusiasts.
problem with generating pdf file with prawn
6 Posts
problem with generating pdf file with prawn

Hi all, I generated pdf file using prawn gem and prawnto gem .All working fine when i take

def show @attendence= Attendence.find(:all) end

but when i take

def show @attendence= Attendence.find(:all,:conditions => ["date >= ? AND date = ? AND date 'att.pdf', :type => 'application/pdf', :disposition => 'inline'

end

end

end

Running as: http://localhost:3000/attendence_report/att.pdf. please help me.

It dont make sense, @attendence from find.all or from find(:conditions) should be similar, a name value pair variable, only with different values.

Are you sure your find with conditions is returning values? I would print that out to make sure. Sometimes the silly simple thing is the answer.

Hi i changed code according to railscasts(prawn with pdfs).But still not working. Here is my code:

controller:attendence_report

def show

@attendence= Attendence.find(:all,:conditions => ["date >= ? AND date { 0 => :left, 1 => :right, 2 => :right, 3 => :right }

pdf.move_down(10)

When in index page i have startdate,enddate and grade selection. but i select these goes to show page and displays values then i have link to pdf.when i click link giving this error:

data must be a non-empty, non-nil, two dimensional array of Prawn::Cells or strings at pdf.table attendences. I removed table and verfied with pdf.text nothing is diaplying.please help anything wrong in passing variable to pdf.please help me

I would try the following.

instead of outputing the first_name try the count

@attendence= Attendence.find(:all,:conditions => ["date >= ? AND date

end

Thanks Tim It worked.

6 Posts
Login to add your message