Skip to content

Commit afeac5a

Browse files
committed
switch to safe operators
1 parent a0f351d commit afeac5a

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

lib/polymorphic_integer_type/belongs_to_polymorphic_association_extension.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ module Associations
33
class BelongsToPolymorphicAssociation < BelongsToAssociation
44
private def replace_keys(record)
55
super
6-
klass = record.nil? ? record.class : record.class.base_class
7-
8-
owner[reflection.foreign_type] = klass
6+
owner[reflection.foreign_type] = record&.class&.base_class
97
end
108
end
119
end

0 commit comments

Comments
 (0)