title: Filtering a dropdown based on the value in another dropdown in Rails
body: <p>I have a Country model. In view I have a country dropdown. If country1 is selected, all states of that country must be listed in states dropdown box. If country2 is selected, only 'others' must be displayed in the drop down box. I have jquery to do this. but how do i access a constant defined in ruby in jquery? How do I do that?</p>
  
  <pre><code>          $('#country_id').change(function() {
              debugger
              var country = $('#country_id').val();
               if (country != 'India') {
                  // $('#country_state').val("others");
                  //$('#country_state').prop("disabled", true);
                  $('#country_state').empty().append('&lt;option&gt;Other&lt;/option&gt;');
                  $('#phone').focus();
  
              }
              else{
               $('#country_state').empty().append('&lt;option&gt;indiastates*&lt;/option&gt;');
              }
  
          })
  </code></pre>
  
  <p>*indiastates is a constant in ruby. How do i display that as options for dropdown?</p>