Add UUIDs to existing ActiveRecord models.
To install:
rake uuidify:install:migrations
rake db:migrate
To enable on a specific model:
class Foo < ActiveRecord::Base
uuidify
end
To get/set uuids:
Foo.new.uuid
Foo.new.uuid = UUIDTools::UUID.timestamp_create
Uuidify should hook into ActiveRecord's #destroy
and automatically
clean up entries. However, if you bypass #destroy
or remove uuidify
from a given model, you might need to run manual garbage collection to
clean up existing stale uuids.
To gc orphan records:
Foo.garbage_collect_uuids # single model
Uuidify.garbage_collect_uuids # everything, even if the model doesn't exist in the source
This gem is signed with rubygems-openpgp. You can verify its integrity by running:
gem install uuidify --verify
Signing key:
pub 2048R/E3B5806F 2010-01-11 [expires: 2014-01-03]
Key fingerprint = A530 C31C D762 0D26 E2BA C384 B6F6 FFD0 E3B5 806F
uid Grant T. Olson (Personal email) <[email protected]>
uid Grant T Olson <[email protected]>
uid Grant T. Olson (pikimal) <[email protected]>
sub 2048R/6A8F7CF6 2010-01-11 [expires: 2014-01-03]
sub 2048R/A18A54D6 2010-03-01 [expires: 2014-01-03]
sub 2048R/D53982CE 2010-08-31 [expires: 2014-01-03]