title: Rails checkbox AJAX call, don't want to render anything
body: <p>I've got a little demo setup in which clicking a checkbox toggles an attribute via AJAX. It's working fine, but Rails REALLY wants to render something, so I've basically resorted to creating a blank toggle.js.erb file in my views.</p>
  
  <p><strong>Controller action in question:</strong></p>
  
  <pre><code>def toggle
    @task = Task.find(params[:id])
    respond_to do |format|
      format.js do
        if (@task.status != true)
          @task.status = true
        else
          @task.status = false
        end
        @task.save
        render :layout =&gt; false
      end
    end
  end
  </code></pre>
  
  <p><strong>View in question:</strong></p>
  
  <pre><code>  &lt;h1&gt;Tasks&lt;/h1&gt;
    &lt;ul style="list-style-type: none;"&gt;
      &lt;% @tasks.each do |task| %&gt;
        &lt;li id="&lt;%= dom_id(task) %&gt;"&gt;
        &lt;%= check_box_tag(dom_id(task), value = nil, checked = task.status) %&gt;
        &lt;%= task.action %&gt; &lt;%= link_to 'Edit', edit_task_path(task) %&gt;
        &lt;%= link_to 'Delete', task, :confirm =&gt; 'Are you sure?', :method =&gt; :delete, :remote =&gt; true %&gt;
        &lt;/li&gt;
      &lt;% end %&gt;
    &lt;/ul&gt;
    &lt;%= link_to 'New Task', new_task_path %&gt;
  
    &lt;script&gt;
      $$('input').each(function(el) {
        el.observe('click', function(event) {
          // Get the task ID
          var elId = el.id.split("_")[1];
          // Build the toggle action path
          var togglePath = '/tasks/' + elId + '/toggle/';
          // Create request, disable checkbox, send request,
          // enable checkbox on completion
          new Ajax.Request(togglePath, {
            onCreate: function() {
              el.disable();
            },
            onSuccess: function(response) {
            },
            onComplete: function() {
              el.enable();
            }
          });
        });
      });
    &lt;/script&gt;
  </code></pre>
  
  <p>Without the blank toggle.js.erb file I've got in the views, Rails still gives me an error saying that it's trying to render something.</p>
  
  <p>Ultimately, I'd like to both not have to have a blank toggle.js.erb file, and I'd like to get that Prototype stuff into my static JavaScript stuff and out of the view.</p>
  
  <p>I'm pretty new to Rails, so there's probably an easier way to be doing this, but I'm kind of stuck here.</p>