I know prawn is working because I have a show action that if I add .pdf on to the end of it loads show.pdf.prawn. However, I have a form:
<%= form_tag(:controller => "/holders", :action=> "generate", format: "pdf") do %>
<%= label_tag(:count, "How Many Students?") %>
<%= text_field_tag(:count) %>
<%= hidden_field_tag :holder_id, value: @holder%>
<%= submit_tag("Generate Course Lesson") %>
<% end %>
That submits count to the the generate action.
Inside my generate action I have the following:
def generate
prawnto :filename => "print.pdf"
respond_to do |format|
format.html
format.pdf { render :layout => false}
end
end
and my generate.pdf.prawn looks like:
pdf.text "HELLO WORLD"
When I submit the form I get the URL: http://localhost:3000/generate.pdf
and Chrome tells me
Failed to load PDF document
with no other errors or information.
I noticed I am getting: Rendered holders/generate.pdf.erb
in my dev logs which indicates its not even looking for the .prawn file.
What am I doing wrong?