Skip to content

Instantly share code, notes, and snippets.

@zmajstor
Created January 6, 2014 14:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zmajstor/8283948 to your computer and use it in GitHub Desktop.
Save zmajstor/8283948 to your computer and use it in GitHub Desktop.
Rails (ActiveRecord) after_save callback for single field change
class MyModel < ActiveRecord::Base
after_save :do_something, if: :my_filed_changed?
def do_something
# my_filed has been changed ... do something
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment