On Jul 4, 2007, at 1:23 AM, Juan Matias wrote:
> 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?
Sure, just raise an exception.
-- fxn
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---