Written by Gabriel Gironda
Github: Page Clone
What is this?
This plugin adds auto-generated UUIDs to ActiveRecord models.
To add this capability to existing models:
class AddUuidToInvites < ActiveRecord::Migration def self.up change_table :invites do |t| t.uuid end end
To set it up when creating new tables:
class CreatePeople < ActiveRecord::Migration def self.up create_table :people do |t| t.string :name t.uuid end end
When your record is created, it’ll have a UUID, accessible via the ‘uuid’ attribute.
- The generate_uuids! migration helper seems not to work, possibly because the uuid attribute is read-only.
- Test cases failed to catch the above.
- Addition of index in uuid migration is broken. See commit 697a2f7b02681b03ef1f7624f58ea19a622b3a32.
Copyright © 2007 Gabriel Gironda, released under the MIT license