title: Rendering a partial from a controller in rails
body: <p>I have a form that is adding rows to the DB via remote => true. I then want to append the new data to a table, but cannot get the correct view to render.</p>
  
  <p>As of now, it is rendering the entire show.html.erb page for the new entry, but I want to layout a minimal version to be added as a . Is there a quick way to tell my controller what view to render after inserting into the db? I want to render my partial named _newly_added.html.erb</p>
  
  <p><strong>My Controller</strong></p>
  
  <pre><code>  def new
      @task = Task.new
      render :partial =&gt; "/tasks/newly_added", :locals =&gt; { :t =&gt; @task }
    end
  </code></pre>
  
  <p>Thanks!!</p>
  
  <p><strong>EDIT</strong>
  I think what I need is just an alternative "show" view.</p>
  
  <p>I found that the method I needed to change was actually this:</p>
  
  <pre><code>  def create
      @task = Task.new(params[:task])
  
      respond_to do |format|
        if @task.save
          format.html { redirect_to @task, notice: 'Task was successfully created.' }
          format.json { render json: @task, status: :created, location: @task }
        else
          format.html { render action: "new" }
          format.json { render json: @task.errors, status: :unprocessable_entity }
        end
      end
    end
  </code></pre>
  
  <p>I just need to make an alternative show view, and then tell this to redirect_to that view.</p>