ActiveRecord callbacks, such as before_save
, after_save
, etc., are methods that are executed at specific points
in the lifecycle of a model. However, in this case, the callbacks are not being executed in the correct order,
leading to unexpected behavior.
class Person < ApplicationRecord
after_commit :after_commit_callback
before_validation :before_validation_callback
end
class Person < ApplicationRecord
before_validation :before_validation_callback
after_commit :after_commit_callback
end