【发布时间】:2018-05-24 07:12:15
【问题描述】:
我有这个动作,
def email_student_report
@current_year = Time.new.year
@past_year = @current_year - 1
end
使用此链接,
<%= link_to 'Email', samplecardreport_path(format: :pdf), :class => 'btn btn-warning termact_btns' %>
我将此操作称为此操作并使用 wicked_pdf 生成 PDF 文档
def sample_card_report
@subjects = Subject.all
@properties = Property.first
@studentid = Student.where('studentid = ?', params[:email_search_stuent_id]).last!
#@studentid = Student.where('studentid = ?', 'EkGSS-181').last!
@studentresults = TermReport.where('studentid =? and term =? and form_class =? and year =?', params[:email_search_stuent_id], params[:term], params[:form_class], params[:year])
@totalstudent = TermReport.group('form_class, term, year, studentid').where('form_class =? and term =? and year =?', params:form_class],params[:term],params[:year],)
respond_to do |format|
format.html
format.pdf do
render pdf: 'student_report_card',
template: "term_reports/sample_card_report.pdf.erb"
end
end
end
现在我的问题是生成的 PDF 文档是空白的。并且调试显示表单参数没有被传递,因此查询正在获取空白。我该如何解决这个问题?
【问题讨论】:
标签: ruby-on-rails-4 wicked-pdf