Skip to content

Instantly share code, notes, and snippets.

@texpert
Last active October 7, 2017 13:59
Show Gist options
  • Save texpert/617499a5e3d07479e71f57010470b321 to your computer and use it in GitHub Desktop.
Save texpert/617499a5e3d07479e71f57010470b321 to your computer and use it in GitHub Desktop.
Legend:
=> in the meaning column means there's a non-boolean return value
empty columns in Prior Name mean the method didn't exist before
* before a new method name means it's an alias to the prior method
Prior Name New Name Meaning
attribute_was(attr_name) *attribute_in_database(attr_name) current database value of attribute
attribute_change(attr_name) *attribute_change_to_be_saved => the changed value for attribute
attribute_changed?(attr_name) *will_save_change_to_attribute?(attr_name) was attribute modified since last save
attribute_before_last_save(attr_name) => attribute value from before last save
changed *changed_attribute_names_to_save => name of attributes with changed values since last save
changes *changes_to_save => the changes to be saved to DB
changed? *has_changes_to_save? are there any changes to be saved to the DB?
changed_attributes *attributes_in_database => Hash of attribute names & new unsaved values
changed? has_changes_to_save? record has unsaved changes
saved_changes? did last save change record attributes?
saved_changes => Hash of all changes in last save
saved_change_to_attribute?(attr_name) did attribute change when record last saved?
saved_change_to_attribute(attr_name) => array of original & saved value from last save
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment