coton_app/app/controllers/admin/p_ship_tour_trucks_controller.rb
2018-12-15 14:06:53 +01:00

26 lines
603 B
Ruby

# -*- encoding : utf-8 -*-
class Admin::PShipTourTrucksController < ApplicationController
layout "admin"
before_filter :auth_admin
def update_ship_tour_truck_sheet_lines
@p_ship_tour_truck = PShipTourTruck.find(params[:id])
@p_ship_tour_truck.p_ship_tour_truck_sheet_lines.destroy_all
i = 0
params[:sheet_line_ids].to_a.each do |sheet_line_id|
@p_ship_tour_truck.p_ship_tour_truck_sheet_lines << PShipTourTruckSheetLine.new(:p_sheet_line_id => sheet_line_id.to_i, :position => i)
i += 1
end
render :inline => "ok", :layout => false
end
end