lib/avo/base_resource.rb in avo-2.21.1.pre.issue1450 vs lib/avo/base_resource.rb in avo-2.21.1.pre.pr1476
- old
+ new
@@ -115,12 +115,13 @@
name == association_name
end
end
def valid_attachment_name(record, association_name)
- get_record_associations(record).keys.each do |name|
- return association_name if name == "#{association_name}_attachment" || name == "#{association_name}_attachments"
+ association_exists = get_record_associations(record).keys.any? do |name|
+ name == "#{association_name}_attachment" || name == "#{association_name}_attachments"
end
+ return association_name if association_exists
end
def get_available_models
ApplicationRecord.descendants
end