title: What is the best way to add a text field to a form select in rails?
body: <p>In rails 4 I have a form select with three options, one of which is called 'other' where I want to display a text field and have the input sent to server as the form value.</p>
  
  <pre><code>.field
      = f.label :answer, 'Please select..'
      = f.select :answer, ['option a','option b','other...'], prompt: 'Select One'
      #other
       .other
        = f.text_field :answer
  </code></pre>
  
  <p>model.js.coffee</p>
  
  <pre><code>jQuery -&gt;
    other = $('#other').html()
    $('.other').remove()
    if $('#mymodel_answer :selected').text() == 'other...'
      $('#other').html(other)
    $('#mymodel_answer').change -&gt;
      if $('#mymodel_answer :selected').text() == 'other...'
        $('#other').html(other)
      if $('#mymodel_answer :selected').text() != 'other...'
        $('.other').remove()
  </code></pre>
  
  <p>this works but feels a little hacky, what other ways are there to do this?</p>