Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ProjectObserver < ActiveRecord::Observer
- def after_find(project)
- @original = project.clone
- end
- def after_update(project)
- changed_fields = []
- Project.columns.map(&:name).each do |column|
- unless column == "id" || column == "updated_at"
- unless project.attributes[column] == @original.attributes[column]
- project.logger.debug " *** #{column}: #{project.attributes[column]} vs #{@original.attributes[column]} ***"
- changed_fields.push(column)
- end
- end
- end
- ProjectMailer::deliver_modify(project, changed_fields)
- end
- end
Add Comment
Please, Sign In to add comment