I was wondering in what order are callbacks and validations called when an ActiveRecord object is created.
Let’s say I have some custom validations & callbacks like the following:
validates :reference_code, :if => :reference_code, :on => :create
before_create :assign_reference
which one will run first? The callback needs to happen first or else the validation may fail.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…