0
我正在寻找使用对虾PDF和导轨4.2提取所有记录到一个单一的PDF。对虾PDF和多记录记录
目前,我有他们生成的个人PDF格式的ID和运作良好。
显示在表
def show
@agreement = Agreement.find(params[:id])
respond_to do |format|
format.html
format.pdf do
pdf = AgreementPdf.new(@agreement)
send_data pdf.render, filename: "Agreement - #{@agreement.entity}", type: "application/pdf", disposition: "inline"
end
end
end
指数
<% @agreements.each do |agreement| %>
<tr>
<td><%= agreement.entity %></td>
<td><%= link_to 'Download', agreement_path(agreement.id, format: 'pdf'), :target => "_blank" %></td>
</tr>
<% end %>
你将如何调用视图中的变量? – DollarChills
我编辑答案并添加视图和路线。我没有测试,只是代码来展示如何去做 –
钉住它。谢谢你的帮助。 – DollarChills