Class: Cats::Core::DispatchPlanItemsController
  
  
  
  
    
      Instance Method Summary
      collapse
    
    
  
  
  
  
  
  
  
  
  
  Methods included from Common
  #create, #show, #update
  
  
  
  
  
  
  
  
  
  
  #authenticate, #current_user, #skip_bullet
  
  
    Instance Method Details
    
      
  
  
    #filter  ⇒ Object 
  
  
  
  
    
      
18
19
20
21
22
23
24
25
26
27 
     | 
    
      # File 'app/controllers/cats/core/dispatch_plan_items_controller.rb', line 18
def filter
  query = DispatchPlanItem.includes(
    :source,
    :destination,
    {commodity: {project: {source: :commodity_category}}},
    :unit,
    :dispatch_plan
  ).ransack(params[:q])
  render json: {success: true, data: serialize(query.result)}
end
     | 
  
 
    
      
  
  
    #index  ⇒ Object 
  
  
  
  
    
      
6
7
8
9
10
11
12
13
14
15
16 
     | 
    
      # File 'app/controllers/cats/core/dispatch_plan_items_controller.rb', line 6
def index
  super do
    DispatchPlanItem.includes(
      :source,
      :destination,
      {commodity: {project: {source: :commodity_category}}},
      :unit,
      :dispatch_plan
    ).where(dispatch_plan_id: params[:id])
  end
end
     |