title: How can I call `update_attribute` for a list item in rails then actually update the html using jquery?
body: <p>I want my users to be able to mark one or more items from an index view as "Active" or "Inactive" using a link.  The text for the link should be state aware - so it might default to "Mark as Active" if the corresponding attribute was false or null, and "Mark as Inactive" if true.  Once the user clicks the link and the attribute is updated in the controller, the link-text should update based on the new state.</p>
  
  <p>I am WAY off here, but this is a small sample of the code I have been trying...</p>
  
  <pre><code>CONTROLLER
  ...
  respond_to :html, :js
  ...
  def update
    @item = Item.find(params[:id])
    if @item.update_attributes(params[:item])
      #Not sure of how to respond to .js here 
    end
  end
  ...
  </code></pre>
  
  <hr>
  
  <pre><code>update.js.erb
  #how do I identify which element to update?
  $('#item[13456]').html("State aware text for link_to")
  </code></pre>
  
  <hr>
  
  <pre><code>VIEW
  - for item in @items
    = item.name
    = link_to "Mark as Active", item_path(item), :method =&gt; :put, :remote =&gt; true. :id =&gt; "item[#{item.id}]"
  </code></pre>
  
  <p>I am happy to read any APIs, blogs, tutorials, etc.  I just can't seem to get my hands/mind around this task.  Any help or guidance is greatly appreciated!</p>