Skip to content

Instantly share code, notes, and snippets.

@RichGuk
Created July 19, 2011 23:23
Show Gist options
  • Save RichGuk/1093996 to your computer and use it in GitHub Desktop.
Save RichGuk/1093996 to your computer and use it in GitHub Desktop.
attributes.each do |attr|
attr.class.send(:alias_method, :original_set, :set)
attr.class.send(:define_method, :set) do |instance, value|
instance.send(:"#{name}_will_change!") unless value == self.get(instance)
__send__(:original_set, instance, value)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment