anchor.diff:            <%= f.label :hub_id, "Hub" %>
             <span class="required">*</span>
             <%= f.collection_select :hub_id,
  -                  Hub.order(:name), :id, :name, {include_blank: '-- Choose --'}, {:class => 'form-control', :required => true }%>
  +          Hub.order(:name), :id, :name, {include_blank: '-- Choose --'}, {:id => 'hub_select' ,:class => 'form-control', :required => true }%>
           </div>
   
           <div class="form-group">
             <%= f.label :warehouse_id, "Warehouse" %>
             <span class="required">*</span>
             <%= f.collection_select :warehouse_id,
  -                  Warehouse.order(:name), :id, :name, {include_blank: '-- Choose --'}, {:class => 'form-control', :required => true }%>
  +                  @warehouses.select{|w| w.hub_id == @receipt.hub_id}, :id, :name, {include_blank: '-- Choose --'}, {:id => 'warehouse_select',:class => 'form-control', :required => true }%>
  +          
           </div>
   
           <div class="form-group">
  
positive.code: <%= form_for(receipt, :html=> {:id => 'receipt-form'} ) do |f| %>
  <% @projects = Project.all%>
  <% @uoms = UnitOfMeasure.all%>
  <div class="row">
    <div class="wrapper wrapper-content">
      <div class="ibox float-e-margins">
  
negative.code:         updateProjects(donor_id);
        });
  
        $('#hub_select').change(function(){
         
          var hub_id = $(this).val();
         
          var warehouses = <%= @warehouses.to_json.html_safe %>
         
          var warehouses_in_hub = $.grep(warehouses, function (elem) {
            return elem.hub_id == hub_id
          });
       
  
          var warehouse_options = $.map(warehouses_in_hub, function (val) {
            return '<option value="' + val.id + '">' + val.name + '</option>';
          });
  
          warehouse_options.unshift(EMPTY_OPTION);
  
          $('#warehouse_select').html(warehouse_options);
  
        });
  
      });
    </script>
  