Add Rails 7.2+ support#7
Conversation
- Update serialize API to use Rails 7.1+ keyword argument syntax - Replace deprecated update_attributes/update_attributes! with update/update! Rails 7.1 and earlier are now EOL, so this gem now targets Rails 7.2+.
PR SummaryMedium Risk Overview Updates Bumps gem version to Written by Cursor Bugbot for commit 5936b47. This will update automatically on new commits. Configure here. |
|
Also needs a version bump |
|
|
||
| serialize :value, Hash | ||
| if ActiveRecord.version >= Gem::Version.new('7.1') | ||
| serialize :value, coder: YAML, type: Hash |
There was a problem hiding this comment.
Missing default value for serialize may return nil
High Severity
The new Rails 7.1+ serialize syntax serialize :value, coder: YAML, type: Hash may not provide the same default value behavior as the old serialize :value, Hash. In pre-7.1 Rails, YAMLColumn with a Hash class argument returns {} for nil database values. The new syntax with raw YAML coder and type: Hash may return nil instead, causing NoMethodError when code calls value[name] or value.delete(name), and failing the validation value.is_a? Hash. The default: {} option appears to be missing.
Summary
serializeAPI to use Rails 7.1+ keyword argument syntax (coder:,type:)update_attributes/update_attributes!withupdate/update!in testsRails 7.1 and earlier are now EOL, so this gem should targets Rails 7.2+.