Sha256: df8f24065391ad24acc87ee95b26c439033bbc1bec4852c90123704ce9faa0d1

Contents?: true

Size: 351 Bytes

Versions: 55

Compression:

Stored size: 351 Bytes

Contents

module Agilibox::ActiveRecordUUIDConcern
  extend ActiveSupport::Concern

  private

  def assign_default_uuid
    unless self.class.columns_hash["id"].type == :uuid
      raise "invalid id type, please change to uuid"
    end

    self.id ||= ::Agilibox::SortableUUIDGenerator.call
  end

  included do
    before_save :assign_default_uuid
  end
end

Version data entries

55 entries across 55 versions & 1 rubygems

Version Path
agilibox-1.9.6 app/models/concerns/agilibox/active_record_uuid_concern.rb
agilibox-1.9.5 app/models/concerns/agilibox/active_record_uuid_concern.rb
agilibox-1.9.4 app/models/concerns/agilibox/active_record_uuid_concern.rb
agilibox-1.9.3 app/models/concerns/agilibox/active_record_uuid_concern.rb
agilibox-1.9.1 app/models/concerns/agilibox/active_record_uuid_concern.rb
agilibox-1.9.0 app/models/concerns/agilibox/active_record_uuid_concern.rb
agilibox-1.8.0 app/models/concerns/agilibox/active_record_uuid_concern.rb
agilibox-1.7.4 app/models/concerns/agilibox/active_record_uuid_concern.rb
agilibox-1.7.3 app/models/concerns/agilibox/active_record_uuid_concern.rb
agilibox-1.7.2 app/models/concerns/agilibox/active_record_uuid_concern.rb
agilibox-1.7.1 app/models/concerns/agilibox/active_record_uuid_concern.rb
agilibox-1.7.0 app/models/concerns/agilibox/active_record_uuid_concern.rb
agilibox-1.6.2 app/models/concerns/agilibox/active_record_uuid_concern.rb
agilibox-1.6.1 app/models/concerns/agilibox/active_record_uuid_concern.rb
agilibox-1.6.0 app/models/concerns/agilibox/active_record_uuid_concern.rb
agilibox-1.5.13 app/models/concerns/agilibox/active_record_uuid_concern.rb
agilibox-1.5.12 app/models/concerns/agilibox/active_record_uuid_concern.rb
agilibox-1.5.11 app/models/concerns/agilibox/active_record_uuid_concern.rb
agilibox-1.5.10 app/models/concerns/agilibox/active_record_uuid_concern.rb
agilibox-1.5.9 app/models/concerns/agilibox/active_record_uuid_concern.rb