title: Rails: What does it actually mean to "render a template"
body: <p>I've become a bit confused about the idea of "rendering" a "template" due to the way an author speaks about it in a book I'm reading. </p>
  
  <p>My original understanding of "rendering a template" was that it meant that Rails is providing the content that is viewed on the screen/presented to the viewer (in the way that a partial is rendered) but the book I'm reading seems to be using the concept of "rendering a template" to also mean something else. Let me explain in context</p>
  
  <p>This book (rails 3 in action) sets up a page layout using the conventional <code>layouts/application.html.erb</code> file, and then it "yields" to different view pages, such as  <code>views/tickets/show.html.erb</code> which adds more content to the screen.  that's all straightforward..</p>
  
  <p>Within this view <code>views/tickets/show.html.erb</code>, there is a rendering of a partial (which is also a straightforward concept).   </p>
  
  <pre><code>&lt;div id='tags'&gt;&lt;%= render @ticket.tags %&gt;&lt;/div&gt;
  </code></pre>
  
  <p>Now within this partial there is, using ajax, a call to a "remove" method in the "tags_controller.rb" which is designed to allow authorized users to remove a "tag" from a "ticket" in our mock project management application. </p>
  
  <pre><code>&lt;% if can?(:tag, @ticket.project) || current_user.admin? %&gt;
      &lt;%= link_to "x", remove_ticket_tag_path(@ticket, tag),
        :remote =&gt; true,
        :method =&gt; :delete,
        :html =&gt; { :id =&gt; "delete-#{tag.name.parameterize}" } %&gt;
    &lt;% end %&gt;
  </code></pre>
  
  <p>Now here is the "remove" action in the tags controller (which disassociates the tag from the ticket in the database)...</p>
  
  <pre><code>def remove
      @ticket = Ticket.find(params[:ticket_id])
      if can?(:tag, @ticket.project) || current_user.admin?
        @tag = Tag.find(params[:id])
        @ticket.tags -= [@tag]
        @ticket.save
      end
    end
  end
  </code></pre>
  
  <p>At the end of this remove action, the author originally included <code>render :nothing =&gt; true</code> , but then he revised the action because, as he says, "you’re going to get it to render a template."  <strong>Here's where I get confused</strong></p>
  
  <p>The template that he gets this action to render is "remove.js.erb", which only has one line of  jquery inside it,  whose purpose is to remove the "tag" from the page (i.e. the tag that the user sees on the screen) now that it has been disassociated from the ticket in the database. </p>
  
  <pre><code>$('#tag-&lt;%= @tag.name.parameterize %&gt;').remove();
  </code></pre>
  
  <p>When I read "rendering a template" I expect the application to be inserting content into the page, but the template rendered by the "remove" action in the controller only calls a jquery function that removes one element from the page. </p>
  
  <p>If a "template" is "rendered", I'm expecting another template to be removed (in order to make room for the new template), or I'm expecting content to be "rendered" in the way that a partial is rendered.  Can you clarify what is actually happening when a "template" is "rendered" in the situation with the jquery in this question? Is it actually putting a new page in front of the user (I expected some sort of physical page to be rendered)</p>