Plugin details

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

Websitehttp://tools.assembla.com/breakout/wiki/FreeSoftware Repositoryhttp://tools.assembla.com/svn/breakout/breakout/vendor/plugins/guid/ Author Andy Singleton Tags url LicenseMIT

Documentation

Install the plugin:
ruby script/plugin install http://tools.assembla.com/svn/breakout/breakout/vendor/plugins/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'



if you create your tables with migrations, you need to bypass the rails default primary key index. Do this:

create_table :mytable, :id => false do |t|
  t.column :id, :string, :limit => 22
  ... more fields
end 

Further Documentation

There is currently no advanced documentation for this plugin.

New documentation

Edit plugin | (0 older versions) | Last edited by: scott, about 1 year ago