Skip to content

Commit

Permalink
Fix #derived_versions and #active_sibling_versions returning an Array…
Browse files Browse the repository at this point in the history
… where Hash is expected
  • Loading branch information
mshibuya committed Mar 2, 2024
1 parent 78845ea commit 46e4f20
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions lib/carrierwave/uploader/versions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ def recreate_versions!(*names)
# that are the source of another version.

self.cache_id = CarrierWave.generate_cache_id
derived_versions.each do |name, v|
derived_versions.each_value do |v|
v.cache!(file) if names.empty? || !(v.descendant_version_names & names).empty?
end
active_versions.each do |name, v|
Expand Down Expand Up @@ -308,13 +308,13 @@ def active_versions
def derived_versions
active_versions.reject do |name, v|
v.class.version_options[:from_version]
end.to_a + active_sibling_versions.select do |name, v|
end.merge(active_sibling_versions.select do |name, v|
v.class.version_options[:from_version] == self.class.version_names.last
end.to_a
end)
end

def active_sibling_versions
parent_version&.active_versions || []
parent_version&.active_versions || {}
end

def full_filename(for_file)
Expand All @@ -326,23 +326,23 @@ def full_original_filename
end

def cache_versions!(new_file)
derived_versions.each { |name, v| v.cache!(new_file) }
derived_versions.each_value { |v| v.cache!(new_file) }
end

def store_versions!(new_file)
active_versions.each { |name, v| v.store!(new_file) }
active_versions.each_value { |v| v.store!(new_file) }
end

def remove_versions!
versions.each { |name, v| v.remove! }
versions.each_value { |v| v.remove! }
end

def retrieve_versions_from_cache!(cache_name)
active_versions.each { |name, v| v.retrieve_from_cache!(cache_name) }
active_versions.each_value { |v| v.retrieve_from_cache!(cache_name) }
end

def retrieve_versions_from_store!(identifier)
active_versions.each { |name, v| v.retrieve_from_store!(identifier) }
active_versions.each_value { |v| v.retrieve_from_store!(identifier) }
end

end # Versions
Expand Down

0 comments on commit 46e4f20

Please sign in to comment.