title: Rails, change db value when user selects combobox value
body: <p>I have a scaffold for a datatable in Rails 3.2.  When I'm viewing the form I have a combobox which the user can change and the value will be instantly stored in the db without him having to go into edit mode and change it there and press save.</p>
  
  <p>I have captured the changed value using coffeescript:</p>
  
  <pre><code>$(document).ready -&gt;
    $("#change_department").change -&gt;
      $ajax
        url: "/Locations/" + # need to set id and new value here
        success: (data) -&gt;
          alert data # will need to write a confirmation below the combobox
  </code></pre>
  
  <p>What I'm scrathing my head about is what controller action I should call and how I should prepare the data.  I'm thinking that creating a new controller action where I would pass in the id of the model and the new value in the combobox and in the controller I would find the model and pass in the changed value.  This should probably be a get method with two params in the url (I'm not sure how to do this using post).  Is this a good aproach or would anybody suggest alternative method?</p>
  
  <p>How would I get the id and the changed value in the coffeescript code above?</p>
  
  <p>Thanks</p>