I have used validates_uniqueness_of for input2 in the model
The problem is, when there is duplicate record in input2, input1 and the
first record in input2 are inserted into db and commited.
You need to raise an exception so the transaction knows to rollback, so
use
save! (raises ActiveRecord::RecordInvalid when invalid) instead of save
(returns false when invalid).
jeremy
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.