jwood/auroraalarm

View on GitHub
app/models/concerns/belongs_to_user.rb

Summary

Maintainability
A
0 mins
Test Coverage
module BelongsToUser
  extend ActiveSupport::Concern

  included do
    belongs_to :user
    scope :for_user, ->(user) { where(user_id: user) }
  end

  module ClassMethods
    def distinct_user_ids
      select(:user_id).uniq.map(&:user_id)
    end
  end
end