active_record.cr
active_record.cr copied to clipboard
Support JSON.mapping better
Currently, JSON.mapping
overrides .new({ ... => ... })
constructor with its own.
Workaround for now is to do:
class Post < ActiveRecord::Model
# ...
def initialize(h : Hash)
super(h)
end
JSON.mapping({ ... })
end
This actually will still not work. Since JSON.mapping
expects mapped fields to be in @<field_name>
, but they are in @typed_fields[<field type>][<field name>]
at the moment.