Commit 97b1bc5
committed
Mix
By including the [ActiveModel::AttributeAssignment][], the `Base` class
can access the [assign_attributes][] method for bulk assignment of
attributes **without** saving them to the server (like through
`Base#update_attributes`).
```ruby
Person.schema = { name: "string" }
person = Person.new
person.id # => nil
person.name # => nil
person.assign_attributes id: 1, name: "Matz"
person.id # => 1
person.name # => "Matz"
```
[ActiveModel::AttributeAssignment]: https://edgeapi.rubyonrails.org/classes/ActiveModel/AttributeAssignment.html
[assign_attributes]: https://edgeapi.rubyonrails.org/classes/ActiveModel/AttributeAssignment.html#method-i-assign_attributesActiveModel::AttributeAssignment into Base
1 parent ebcc2a5 commit 97b1bc5
2 files changed
+23
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1835 | 1835 | | |
1836 | 1836 | | |
1837 | 1837 | | |
1838 | | - | |
| 1838 | + | |
1839 | 1839 | | |
1840 | 1840 | | |
1841 | 1841 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1008 | 1008 | | |
1009 | 1009 | | |
1010 | 1010 | | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
1011 | 1033 | | |
1012 | 1034 | | |
1013 | 1035 | | |
| |||
0 commit comments