daily pastebin goal
37%
SHARE
TWEET

Untitled

a guest Apr 17th, 2018 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class ProjectObserver < ActiveRecord::Observer
  2.   def after_find(project)
  3.     @original = project.clone
  4.   end
  5.  
  6.   def after_update(project)
  7.     changed_fields = []
  8.     Project.columns.map(&:name).each do |column|
  9.       unless column == "id" || column == "updated_at"
  10.         unless project.attributes[column] == @original.attributes[column]
  11.           project.logger.debug " *** #{column}: #{project.attributes[column]} vs #{@original.attributes[column]} ***"
  12.           changed_fields.push(column)
  13.         end
  14.       end
  15.     end
  16.     ProjectMailer::deliver_modify(project, changed_fields)
  17.   end
  18. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top