title: Rails: code in model or controller
body: <p>What is the best approach here? I'm trying to clean up some code and I'm wondering if the controller is the best place for this variety of logic:</p>
  
  <pre><code>if user_signed_in?
    if current_user.try(:admin?)
      @docs = Doc.chronologic.page(params[:page]).per(5)
      @orders = Order.chronologic.page(params[:page]).per(5)
    else
      @docs = Doc.chronologic.where(:user_id =&gt; current_user.ftp, :retired =&gt; "active").page(params[:page]).per(5)
      @orders = Order.chronologic.where(:user =&gt; current_user.ftp).page(params[:page]).per(5)
    end
    respond_to do |format|
      format.html
      format.json { render json: @docs }
    end
  else 
    redirect_to new_user_session_path
  end
  </code></pre>
  
  <p>If there's a better location for it, where would it be?</p>
  
  <p>Thanks!</p>
  
  <p><strong>Edit:</strong> it's far worse for methods like <code>pdf</code> which has line after line of instructions for Prawn, but I can't seem to get <code>send_data</code> to work from the model.</p>