Transactions rollback question

I have something like this:

def import_from_csv(csv_file)

Item.transaction do
FasterCSV.foreach(csv_file.path) do |row|
item = Item.new(:name => row[0], :units => row[1], :price =>
row[2])
item.save!
end
end #transaction

end

If I got a negative price I want to rollback all items saved.It’s
possible?

On Jul 4, 2007, at 1:23 AM, Juan M. wrote:

If I got a negative price I want to rollback all items saved.It’s
possible?

Sure, just raise an exception.

– fxn