Sha256: ea3ebd9363f75867d8460ff48fd9828871a42fa1537855c89ebcdc8aff5878ce
Contents?: true
Size: 498 Bytes
Versions: 2
Compression:
Stored size: 498 Bytes
Contents
# frozen_string_literals module Jobshop class Collection < ApplicationRecord self.primary_keys = %i[ organization_id collection_id ] after_initialize { self.collection_id ||= SecureRandom.uuid if new_record? } belongs_to :organization, inverse_of: :collections has_many :things, inverse_of: :collection, foreign_key: %i[ organization_id collection_id ] validates :name, presence: true, uniqueness: { scope: :organization_id, case_sensitive: false } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
jobshop-0.0.167 | app/models/jobshop/collection.rb |
jobshop-0.0.163 | app/models/jobshop/collection.rb |