Skip to content

Instantly share code, notes, and snippets.

@pmatsinopoulos
Last active April 12, 2025 09:04
Show Gist options
  • Save pmatsinopoulos/20dbde10b987886c0d5edfb43b8ace4a to your computer and use it in GitHub Desktop.
Save pmatsinopoulos/20dbde10b987886c0d5edfb43b8ace4a to your computer and use it in GitHub Desktop.
UserBalance model for the blog post on Singleton Sidekiq Job
class UserBalance < ApplicationRecord
belongs_to :user, inverse_of: :user_balance
validates :user_id, uniqueness: true
validates :balance, numericality: { greater_than_or_equal_to: 0 }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment