Module: ActiveUUID::UUID::ClassMethods

Defined in:
lib/activeuuid/uuid.rb

Instance Method Summary collapse

Instance Method Details

#natural_key(*attributes) ⇒ Object



109
110
111
# File 'lib/activeuuid/uuid.rb', line 109

def natural_key(*attributes)
  self._natural_key = attributes
end

#uuid_columnsObject



129
130
131
# File 'lib/activeuuid/uuid.rb', line 129

def uuid_columns
  @uuid_columns ||= columns.select { |c| c.type == :uuid }.map(&:name)
end

#uuid_generator(generator_name) ⇒ Object



118
119
120
# File 'lib/activeuuid/uuid.rb', line 118

def uuid_generator(generator_name)
  self._uuid_generator = generator_name
end

#uuid_namespace(namespace) ⇒ Object



113
114
115
116
# File 'lib/activeuuid/uuid.rb', line 113

def uuid_namespace(namespace)
  namespace = UUIDTools::UUID.parse_string(namespace) unless namespace.is_a? UUIDTools::UUID
  self._uuid_namespace = namespace
end

#uuids(*_attributes) ⇒ Object



122
123
124
125
126
127
# File 'lib/activeuuid/uuid.rb', line 122

def uuids(*_attributes)
  ActiveSupport::Deprecation.warn <<-EOS
    ActiveUUID detects uuid columns independently.
    There is no more need to use uuid method.
  EOS
end