diff --git a/shard.yml b/shard.yml index ae94871..a017e98 100644 --- a/shard.yml +++ b/shard.yml @@ -1,5 +1,6 @@ name: active-model -version: 2.0.3 +version: 2.0.4 +crystal: ">= 1.0.0" dependencies: http-params-serializable: diff --git a/src/active-model/model.cr b/src/active-model/model.cr index 791aa9e..f69d7de 100644 --- a/src/active-model/model.cr +++ b/src/active-model/model.cr @@ -472,7 +472,11 @@ abstract class ActiveModel::Model class {{ converter }} def self.from_json(value : JSON::PullParser) : {{enum_type}} - {{enum_type}}.new(value) + {% if column_type_str == "Int32" %} + {{enum_type}}.from_value(value.read_int) + {% else %} + {{enum_type}}.new(value) + {% end %} end def self.to_json(value : {{enum_type}}, json : JSON::Builder)