Module: ActiveUUID::UUID::ClassMethods
- Defined in:
- lib/activeuuid/uuid.rb
Instance Method Summary collapse
- #instantiate_with_uuid(record) ⇒ Object
- #natural_key(*attributes) ⇒ Object
- #uuid_columns ⇒ Object
- #uuid_generator(generator_name) ⇒ Object
- #uuids(*attributes) ⇒ Object
Instance Method Details
#instantiate_with_uuid(record) ⇒ Object
107 108 109 110 111 112 |
# File 'lib/activeuuid/uuid.rb', line 107 def instantiate_with_uuid(record) uuid_columns.each do |uuid_column| record[uuid_column] = UUIDTools::UUID.serialize(record[uuid_column]).to_s if record[uuid_column] end instantiate_without_uuid(record) end |
#natural_key(*attributes) ⇒ Object
92 93 94 |
# File 'lib/activeuuid/uuid.rb', line 92 def natural_key(*attributes) self._natural_key = attributes end |
#uuid_columns ⇒ Object
114 115 116 |
# File 'lib/activeuuid/uuid.rb', line 114 def uuid_columns @uuid_columns ||= columns.select { |c| c.type == :uuid }.map(&:name) end |
#uuid_generator(generator_name) ⇒ Object
96 97 98 |
# File 'lib/activeuuid/uuid.rb', line 96 def uuid_generator(generator_name) self._uuid_generator = generator_name end |
#uuids(*attributes) ⇒ Object
100 101 102 103 104 105 |
# File 'lib/activeuuid/uuid.rb', line 100 def uuids(*attributes) ActiveSupport::Deprecation.warn " ActiveUUID detects uuid columns independently.\n There is no more need to use uuid method.\n EOS\nend\n" |