I’m pretty sure this causes an infinite loop if you need to convert a model column into a rich_text field and do something like
model.update/update_attribute(content: model.old_content). I’ve never seen such a bad loop — I actually had to kill my PostgreSQL process.
At scale, wouldn't adding an update call to every action for every user just be hammering the database?
I think you would actually want to call
before_validation :set_referral_code, on: :create to summarize the comments from above.