class Jennifer::Model::JSONSerializableConverter(T)

Overview

Allows to serialize/deserialize JSON column to/from T.

class Location
  include JSON::Serializable

  property latitude : Float64
  property longitude : Float64
end

class User < Jennifer::Model::Base
  mapping(
    # ...
    location: {type: Location, converter: Jennifer::Model::JSONSerializableConverter(Location)}
  )
end

Defined in:

jennifer/model/json_serializable_converter.cr

Class Method Summary

Class Method Detail

def self.from_db(pull, options) #

[View source]
def self.from_hash(hash : Hash, column, options) #

[View source]
def self.to_db(value : Nil, options) : Nil #

[View source]
def self.to_db(value : T, options) : String #

[View source]