Sure. That would be in cases were you can clean up your data in the controller or use database default values. For instance, if I have an article model with a boolean datatype for the published value, and I am using a before_validation to set the default value of false if its nil, that is a wrong use of callbacks even if it works. You could have easily set a default value when creating that database column since we know it's always going to be false until the creator of the article decides to publish it.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Sure. That would be in cases were you can clean up your data in the controller or use database default values. For instance, if I have an article model with a boolean datatype for the published value, and I am using a
before_validation
to set the default value offalse
if its nil, that is a wrong use of callbacks even if it works. You could have easily set a default value when creating that database column since we know it's always going to be false until the creator of the article decides to publish it.