24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'app/controllers/m/icol/customers_controller.rb', line 24
def update
@customer = Customer.unscoped.find_by_id(params[:id])
@customer.attributes = params[:customer]
if !@customer.valid?
render "edit"
else
@customer.updated_by = current_user.id
@customer.save!
flash[:alert] = 'Customer successfully modified successfully'
redirect_to @customer
end
rescue ActiveRecord::StaleObjectError
@customer.reload
flash[:alert] = 'Someone edited the customer the same time you did. Please re-apply your changes to the customer.'
render "edit"
end
|