Skip to content

Instantly share code, notes, and snippets.

@salbito
Forked from Mikr0Tik/person.rb
Created January 18, 2010 14:41
Show Gist options
  • Save salbito/280055 to your computer and use it in GitHub Desktop.
Save salbito/280055 to your computer and use it in GitHub Desktop.
class Person < ActiveRecord::Base
before_update :before_update_changes
attr_accessor :update_changes
def before_update_changes
@update_changes = changes
end
end
p = Person.first
p.name = 'Smith'
p.save
p.update_changes # --> {"name" => ['Connor', 'Smith']}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment