You can call validation first, and proceed to saving
only if everything validates:
if @user.valid? && @team.valid?
@user.save(false)
@team.save(false)
end
the ‘valid?’ method does what you’d expect; the
‘false’ paramter to the save method means “don’t do
validation while saving” (since by the time you get to
the save statement, the validation has already
passed).
Cheers,
B Gates
But if I do @user.save and then @team.save, whether
validations on team
failed,
the user is created but team doesn’t and I want non of
them to be
saved.
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com