Skip to content

Instantly share code, notes, and snippets.

@jenncoop

jenncoop/json_gem_coder.rb

Last active Aug 29, 2015
Embed
What would you like to do?
Rails Custom Coder to Restore JSON Gem Behaviour
class JSONGemCoder
def self.dump(obj)
::JSON.dump(obj)
end
def self.load(json)
::JSON.load(json)
end
end
class YourModel < ActiveRecord::Base
serialize :your_attribute, JSONGemCoder
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.