Merge pull request #37018 from santib/fix-activestorage-conditions
Fix conditions in ActiveStorage
This commit is contained in:
commit
e5c143c401
|
@ -97,13 +97,13 @@ module ActiveStorage
|
|||
def #{name}=(attachables)
|
||||
if ActiveStorage.replace_on_assign_to_many
|
||||
attachment_changes["#{name}"] =
|
||||
if attachables.nil? || Array(attachables).none?
|
||||
if Array(attachables).none?
|
||||
ActiveStorage::Attached::Changes::DeleteMany.new("#{name}", self)
|
||||
else
|
||||
ActiveStorage::Attached::Changes::CreateMany.new("#{name}", self, attachables)
|
||||
end
|
||||
else
|
||||
if !attachables.nil? || Array(attachables).any?
|
||||
if Array(attachables).any?
|
||||
attachment_changes["#{name}"] =
|
||||
ActiveStorage::Attached::Changes::CreateMany.new("#{name}", self, #{name}.blobs + attachables)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue