I have the following association in my app:
# Page belongs_to :status
I want to run a callback anytime the status_id of a
status_id
Try this
after_validation :do_something, if: ->(obj){ obj.status_id.present? and obj.status_id_changed? } def do_something # your code end
Reference - http://apidock.com/rails/ActiveRecord/Dirty