Last active
August 29, 2015 14:03
-
-
Save jenncoop/8c4142bbe59da77daa63 to your computer and use it in GitHub Desktop.
Rails Custom Coder to Restore JSON Gem Behaviour
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class JSONGemCoder | |
def self.dump(obj) | |
::JSON.dump(obj) | |
end | |
def self.load(json) | |
::JSON.load(json) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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