Class: ActiveRecord::FixtureSet

Inherits:
Object
  • Object
show all
Defined in:
lib/uuid_attribute/railtie.rb

Defined Under Namespace

Classes: TableRow

Class Method Summary collapse

Class Method Details

.identify(label, column_type = :integer) ⇒ Object



50
51
52
53
54
55
56
57
# File 'lib/uuid_attribute/railtie.rb', line 50

def identify(label, column_type = :integer)
  if column_type == :uuid
    generated_uuid = Digest::UUID.uuid_v5(Digest::UUID::OID_NAMESPACE, label.to_s)
    UuidAttribute::Utils.raw_bytes(UuidAttribute::Utils.normalize(UuidAttribute::Utils.parse(generated_uuid)))
  else
    Zlib.crc32(label.to_s) % MAX_ID
  end
end