Skip to content

Commit

Permalink
Fix deprecated argument in Rails 7.1 and newer
Browse files Browse the repository at this point in the history
Removed in Rails 8.0, see rails/rails@8069cc8
  • Loading branch information
theodorton committed May 28, 2024
1 parent 1a14441 commit 030f7f5
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ def unserialized_model
end

def with_serialized_attr(type: nil, coder: YAML)
type_or_coder = rails_version >= 7.1 ? nil : type || coder
args = rails_version >= 7.1 ? [] : [type || coder]

define_model(:example, attr: :string) do
if type
serialize :attr, type_or_coder, type: type, coder: coder
serialize :attr, *args, type: type, coder: coder
else
serialize :attr, type_or_coder, coder: coder
serialize :attr, *args, coder: coder
end
end.new
end
Expand Down

0 comments on commit 030f7f5

Please sign in to comment.