lib/avo/base_resource.rb in avo-3.6.1 vs lib/avo/base_resource.rb in avo-3.6.2
- old
+ new
@@ -122,11 +122,12 @@
def valid_attachment_name(record, association_name)
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
+
+ association_name if association_exists
end
def get_available_models
ApplicationRecord.descendants
end
@@ -469,14 +470,16 @@
Digest::MD5.hexdigest(content_to_be_hashed)
end
def cache_hash(parent_record)
+ result = [record, file_hash]
+
if parent_record.present?
- [record, file_hash, parent_record]
- else
- [record, file_hash]
+ result << parent_record
end
+
+ result
end
# We will not overwrite any attributes that come pre-filled in the record.
def hydrate_model_with_default_values
default_values = get_fields