Skip to content

Commit 8397729

Browse files
committed
make sure klass is defined for both paths
1 parent bd110dc commit 8397729

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

lib/polymorphic_integer_type/activerecord_5_0_0/polymorphic_array_value_extension.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ def type_to_ids_mapping
1515
default_hash = Hash.new { |hsh, key| hsh[key] = [] }
1616

1717
values.each_with_object(default_hash) do |value, hash|
18+
klass = klass(value)
1819
if association.active_record.respond_to?("#{name}_type_mapping")
1920
mapping = association.active_record.send("#{name}_type_mapping")
20-
klass = klass(value)
2121
key ||= mapping.key(klass.polymorphic_name)
2222
key ||= mapping.key(klass.sti_name)
2323
key ||= mapping.key(klass.base_class.to_s)

0 commit comments

Comments
 (0)