Skip to content

Commit

Permalink
Update activemodel/lib/active_model/serialization.rb
Browse files Browse the repository at this point in the history
Co-authored-by: John Hawthorn <john@hawthorn.email>
  • Loading branch information
ghiculescu and jhawthorn authored Sep 19, 2024
1 parent 8e6c9d6 commit 9dd3cd1
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions activemodel/lib/active_model/serialization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,7 @@ def serializable_hash(options = nil)
return serializable_attributes(attribute_names) if options.blank?

if only = options[:only]
only = Array(only).map(&:to_s)
attribute_names &= only
attribute_names = attribute_names.in_order_of(:itself, only, filter: false)
attribute_names = Array(only).map(&:to_s) & attribute_names
elsif except = options[:except]
attribute_names -= Array(except).map(&:to_s)
end
Expand Down

0 comments on commit 9dd3cd1

Please sign in to comment.