60 Experience
0 Lessons Completed
0 Questions Solved


Posted in Sorting an array of objects in Ruby by object attribute?

I recommend using sort_by instead:

objects.sort_by {|obj| obj.attribute}

Especially if attribute may be calculated.

Try running your worker behind an after_commit callback. It might be because your worker started running even if the data hasn't persisted in your DB yet.

Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

© 2023 GoRails, LLC. All rights reserved.