All get rolled back, that’s the whole point of a transaction. But you’ll need to use save! instead of save so that an exception is raised causing the transaction to fail.
begin Cool.transaction(cool, bad, sad) do
cool.name = “rufus” cool.save!
bad.name = “ratty” bad.save!
sad.name = “kinglsey” sad.save! end
rescue ActiveRecord::RecordInvalid => e p e.record.errors.full_messages end
-Jonathan