Skip to content

Commit

Permalink
fix(model): assign_attributes when model generated from_json
Browse files Browse the repository at this point in the history
  • Loading branch information
stakach committed Oct 10, 2023
1 parent 032e13a commit ba72c7f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion shard.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: active-model
version: 4.3.1
version: 4.3.2
crystal: ">= 1.0.0"
license: MIT

Expand Down
2 changes: 1 addition & 1 deletion src/active-model/model.cr
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ abstract class ActiveModel::Model
def assign_attributes(model : {{@type.name}})
{% for name, opts in FIELDS %}
{% if opts[:mass_assign] == true %}
self.{{name.id}} = model.{{name.id}} if model.{{name.id}}_assigned?
self.{{name.id}} = model.{{name.id}} if model.{{name.id}}_assigned? || model.{{name.id}}_present?
{% end %}
{% end %}
end
Expand Down

0 comments on commit ba72c7f

Please sign in to comment.