Skip to content

Commit

Permalink
feat: add support for crystal 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
stakach committed Mar 22, 2021
1 parent c2be317 commit c3c1c16
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion shard.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: active-model
version: 2.0.3
version: 2.0.4
crystal: ">= 1.0.0"

dependencies:
http-params-serializable:
Expand Down
6 changes: 5 additions & 1 deletion src/active-model/model.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c3c1c16

Please sign in to comment.