I have an array like this
a = [] a << B.new(:name => \"c\") a << B.new(:name => \"s\") a << B.new(:name => \"e\") a << B.new(:n
I know this is an old question but I'm suprised no one thought of this:
B.transaction do broken = a.reject { |o| o.save } raise ActiveRecord::Rollback if broken.present? end if broken.present? # error message end