.where(badges: badge)
.create_with(achieved_on: Time.current)
syntax is ridiculous. Including the mandatory `{}`. And it's the only way to create or find a record if it exists with `[:user_id, :badge_id]` unique index on the `user_badges`. The original `find_or_create` that suffers from race conditions is way easier to use.

Sign in to participate in the conversation

A Mastodon instance for Rubyists & friends