Created
March 18, 2015 09:14
-
-
Save fidothe/39d4ef9b8d84f8ddde77 to your computer and use it in GitHub Desktop.
Use PG JSON datatype with Lotus::Model (hacky hacky)
This file contains hidden or 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
require 'lotus/model' | |
require 'json' | |
module Lotus::Model::Mapping::Coercions | |
def self.JSON(arg) | |
return nil if arg.nil? | |
case arg | |
when String | |
JSON.parse(arg) | |
else | |
Sequel.pg_json(arg) | |
end | |
end | |
end | |
Lotus::Model.configure do | |
... | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment