The #new_record? function determines if a record has been saved. But it is always false in the after_save
hook. Is there a way to determine whether the record i
I like to be specific even I aware that :id
shouldn't change in normal, but
(byebug) id_change.first.nil?
true
It always cheaper to be specific instead finding very weird unexpected bug.
The same way if I expect true
flag from untrustworthy argument
def foo?(flag)
flag == true
end
This saves a lot of hours to not sitting on weird bugs.