ruby on rails - How do i download prawn pdf file while using form submit? -


def index     @forms = form.all     respond_to |format|       format.html     end   end     def submit         respond_to |format|         format.pdf {render  }      end     end  submit.pdf.prawn file pdf.text "successfully submitted" 

it possible prawn generate , return pdf without having to save locally...

def submit   send_data(generate_pdf, :filename => "output.pdf", :type => "application/pdf")  end  private  def generate_pdf     prawn::document.new         text "hello stackoverflow"     end.render  end 

Comments

Popular posts from this blog

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

c++ - Convert big endian to little endian when reading from a binary file -