So I was debugging a issue I was facing and I was struggling to understand why attribute_before_last_save works differently than attribute_was since in docs all I could get is that attribute_before_last_save behaves similarly to attribute_was but in my case I'm getting nil for one and correct value for another.
attibute_before_last_save only work after you save data to db successful.
if you have a callback before save, you should use attibute_was.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With