title: How to render PDF without use respond_to format.pdf in Rails?
body: <p>How can I render send to a client a file (PDF, CSV, etc) without render this file?</p>
  
  <p>For example, imagine a Students controller (created using scaffold), we have 'new' form and 'create' action:</p>
  
  <pre><code>  def new
      @student = Student.new
      respond_to do |format|
        format.html # new.html.erb
      end
    end
  
    def create
      @student = Student.new(params[:student])
      respond_to do |format|
        if @student.save
          flash[:notice] = 'Student created'
          format.html { redirect_to(@student) }
        else
          format.html { render :action =&gt; "new" }
        end
      end
    end
  </code></pre>
  
  <p>When a student is successfully created it will redirect to 'show' template. That is OK!
  But I need to send to client -for example- a PDF file and then render 'show' action.</p>
  
  <p>This PDF file is like a creation receipt for client.</p>
  
  <p>Extra info: now use Prawn to make PDF and sending to client by code like this:</p>
  
  <pre><code>    respond_to do |format|
        format.pdf { render :layout =&gt; false }
      end
  </code></pre>
  
  <p>In brief, I need get filled form, create student, send PDF to browser (as a creation receipt) and render 'show' action to display student created.</p>
  
  <p>Thank you very much.</p>