Skip to content

Commit 144dd24

Browse files
authored
Merge pull request rails#48999 from higher-pixels/activestorage-transformjob-nomethoderror
Fix NoMethodError in ActiveStorage::TransformJob for untracked variants.
2 parents 818bfc2 + 1d212dc commit 144dd24

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

activestorage/app/jobs/active_storage/transform_job.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ class ActiveStorage::TransformJob < ActiveStorage::BaseJob
77
retry_on ActiveStorage::IntegrityError, attempts: 10, wait: :exponentially_longer
88

99
def perform(blob, transformations)
10-
blob.variant(transformations).process
10+
blob.variant(transformations).processed
1111
end
1212
end

activestorage/test/jobs/transform_job_test.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,19 @@ class ActiveStorage::TransformJobTest < ActiveJob::TestCase
1515
end
1616
end
1717
end
18+
19+
test "creates variant when untracked" do
20+
@was_tracking, ActiveStorage.track_variants = ActiveStorage.track_variants, false
21+
transformations = { resize_to_limit: [100, 100] }
22+
23+
begin
24+
assert_changes -> { @blob.variant(transformations).send(:processed?) }, from: false, to: true do
25+
perform_enqueued_jobs do
26+
ActiveStorage::TransformJob.perform_later @blob, transformations
27+
end
28+
end
29+
ensure
30+
ActiveStorage.track_variants = @was_tracking
31+
end
32+
end
1833
end

0 commit comments

Comments
 (0)