Skip to content

Commit d1225c3

Browse files
drusepthclaude
andcommitted
Fix migration error: Use .all.group_by instead of .group_by on model class
The AddPositionToImageUploads migration was calling group_by directly on the ImageUpload class instead of on a collection. This fixes the NoMethodError by properly calling ImageUpload.all.group_by. Also updates Gemfile.lock with arm64-darwin platform support after bundle install. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 3607e1f commit d1225c3

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Gemfile.lock

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1886,6 +1886,7 @@ GEM
18861886
faye-websocket (0.11.3)
18871887
eventmachine (>= 0.12.0)
18881888
websocket-driver (>= 0.5.1)
1889+
ffi (1.17.2-arm64-darwin)
18891890
ffi (1.17.2-x86_64-linux-gnu)
18901891
ffi-compiler (1.3.2)
18911892
ffi (>= 1.15.5)
@@ -1964,6 +1965,7 @@ GEM
19641965
letter_opener (~> 1.9)
19651966
railties (>= 6.1)
19661967
rexml
1968+
libv8-node (16.19.0.1-arm64-darwin)
19671969
libv8-node (16.19.0.1-x86_64-linux)
19681970
listen (3.9.0)
19691971
rb-fsevent (~> 0.10, >= 0.10.3)
@@ -2019,6 +2021,8 @@ GEM
20192021
net-protocol
20202022
netrc (0.11.0)
20212023
nio4r (2.7.4)
2024+
nokogiri (1.18.8-arm64-darwin)
2025+
racc (~> 1.4)
20222026
nokogiri (1.18.8-x86_64-linux-gnu)
20232027
racc (~> 1.4)
20242028
observer (0.1.2)
@@ -2213,6 +2217,7 @@ GEM
22132217
actionpack (>= 6.1)
22142218
activesupport (>= 6.1)
22152219
sprockets (>= 3.0.0)
2220+
sqlite3 (1.7.3-arm64-darwin)
22162221
sqlite3 (1.7.3-x86_64-linux)
22172222
stackprof (0.2.27)
22182223
statsd-ruby (1.5.0)
@@ -2273,6 +2278,7 @@ GEM
22732278
zeitwerk (2.7.2)
22742279

22752280
PLATFORMS
2281+
arm64-darwin-24
22762282
x86_64-linux
22772283

22782284
DEPENDENCIES

db/migrate/20250626212442_add_position_to_image_uploads.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def change
2323
else
2424
# Database-agnostic approach using Ruby
2525
say_with_time("Backfilling positions for ImageUploads") do
26-
ImageUpload.group_by { |img| [img.content_type, img.content_id] }.each do |group_key, images|
26+
ImageUpload.all.group_by { |img| [img.content_type, img.content_id] }.each do |group_key, images|
2727
ordered_images = images.sort_by { |img| [img.created_at || Time.current, img.id] }
2828
ordered_images.each_with_index do |img, idx|
2929
img.update_column(:position, idx + 1)

0 commit comments

Comments
 (0)