Created
August 11, 2015 07:46
-
-
Save danielfone/ecd0710735cc197dfd79 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def changes | |
@changes ||= created_changes + updated_changes + deleted_changes | |
end | |
def created_changes | |
changes_for created_fields, :created | |
end | |
def updated_changes | |
changes_for updated_fields, :updated | |
end | |
def deleted_changes | |
changes_for deleted_fields, :deleted | |
end | |
def changes_for(fields, status) | |
fields.map { |field_name| Change.new(field_name, status) } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment