# Copyright (c) 2005 Assembla, Inc. # # This plugin for ActiveRecord makes the "ID" field into a URL-safe GUID # It is a mashup by Andy Singleton that includes # * the UUID class from Bob Aman. # * the plugin skeleton from Demetrius Nunes # * the 22 character URL-safe format from Andy Singleton # You can get standard 36 char UUID formats instead # TODO: Auto-detect a character ID field and use a GUID in this case (DRY principle) # # This library is free software; you can redistribute it and/or modify it # under the terms of the MIT license. # # TO USE # Install as a plugin in the rails directory vendor/plugin/guid # define ID as char(22) # call "usesguid" in ActiveRecord class declaration, like # class Mymodel < ActiveRecord::Base # usesguid # # if your ID field is not called "ID", call "usesguid :column =>'IdColumnName' " require 'usesguid'