diff --git a/app/models/concerns/image_kind.rb b/app/models/concerns/image_kind.rb index fdc046dd49f..1a482b59e05 100644 --- a/app/models/concerns/image_kind.rb +++ b/app/models/concerns/image_kind.rb @@ -5,14 +5,17 @@ module ImageKind def assign_attributes(attributes) # It's important that the image_kind attribute is assigned first, as it is intended to be used by # carrierwave uploaders when they are mounted to work out which image versions to use. - image_kind_attributes = attributes.slice(:image_kind) - attributes.reverse_merge!(image_kind_attributes) unless image_kind_attributes.empty? - - super + image_kind = attributes.delete(:image_kind) + ordered_attributes = if image_kind.present? + { image_kind:, **attributes } + else + attributes + end + super ordered_attributes end def image_kind - attributes.fetch(:image_kind, "default") + attributes.fetch("image_kind", "default") end def image_kind_config