when I call the save! method in one of my model objects, the validate
method in that same object is called 2 times. Why is this? It doesn’t
happen when I call save (instead of save!), and looking at the source
code of these Rails methods, I don’t understand how ‘validate’ can be
called 2 times when invoking save! and only 1 time when invoking save,
as the code for save! is simply…
when I call the save! method in one of my model objects, the validate
method in that same object is called 2 times. Why is this? It doesn’t
happen when I call save (instead of save!), and looking at the source
code of these Rails methods, I don’t understand how ‘validate’ can be
called 2 times when invoking save! and only 1 time when invoking save,
as the code for save! is simply…
Because both save and save! validate, and save! calls save.
save! validates once in 1.2.
jeremy
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.