Skip to content

Instantly share code, notes, and snippets.

@venkatd
Created October 18, 2012 01:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save venkatd/3909390 to your computer and use it in GitHub Desktop.
Save venkatd/3909390 to your computer and use it in GitHub Desktop.
ActiveRecord::Base.class_eval do
class_attribute :no_serialize_update
self.no_serialize_update = false
end
ActiveRecord::AttributeMethods::Dirty.class_eval do
# Serialized attributes should always be written in case they've been
# changed in place.
def keys_for_partial_update
if self.no_serialize_update
super
else
super + changed_serialized_columns
end
end
def changed_serialized_columns
# ??
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment