Skip to content

Instantly share code, notes, and snippets.

@smathy
Created July 28, 2015 21:58
Show Gist options
  • Save smathy/1f8ffb39b8ac0d1f900d to your computer and use it in GitHub Desktop.
Save smathy/1f8ffb39b8ac0d1f900d to your computer and use it in GitHub Desktop.
class Foo < ActiveRecord::Base
class MyOwnHash
def self.dump(hash)
hash.to_json
end
def self.load(hash)
(hash || {}).with_indifferent_access
end
end
serialize :stuff, MyOwnHash
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment