"\nrequest.variant: #{request.variant.inspect}"
raise ActionController::UnknownFormat, message
elsif interactive_browser_request?
message = "#{self.class.name}\##{action_name} is missing a template " \
"for this request format and variant.\n\n" \
我的控制器
respond_to do |format|
format.html
format.pdf do
pdf = Prawn::Document.new
params[:id] = @ids
@opcionales = Opcionale.where("id= ?", @ids)
...
send_data pdf.render, filename: "Reporte_#{@opcionales}.pdf",
type: "application/pdf",
disposition: "inline"
end
end
我的路线
获取“报告/选项”
获取 'reporte/opcionales/:id', 到: "reporte#opcionales", :defaults => { :format => 'pdf' }
在我看来
{<%= link_to "通用 PDF", '/reporte/opcionales/'+(opcionales.id.to_s)+'.pdf' %>}