Witam
Model:
def move_document_hardware_attributes=(move_document_hardware_attributes)
move_document_hardware_attributes.each do |attributes|
if attributes[:id].blank?
move_document_hardwares.build(attributes)
else
xxx.each do |s|
--> Hardware.update(s[:hardware_id], :status_id => 1) if s[:hardware_id] != attributes[:hardware_id]
end
move_document_hardware = move_document_hardwares.detect {|t| t.id == attributes[:id].to_i}
move_document_hardware.attributes = attributes
--> Hardware.update(attributes[:hardware_id], :status_id => 2)
end
end
end
W dwóch miejscach mam Hardware.update…
Niestety nie wykonują sie one w jednej transakcji razem z aktualizacja czy dodoaniem nowego rekordu.
LOG:
http://rafb.net/p/E1GaX847.html
Jak to poprawić aby wszytko wykonywało sie w jednej transakcji?
Pozdrawiam