Code Monkey home page Code Monkey logo

acts_as_universally_unique's Introduction

ActsAsUniversallyUnique
=======================

This plugin adds a UUID field to the models that acts_as_universally_unique. 
This plugin relies on the UUID gem: http://github.com/assaf/uuid/tree/master. 
You can read more about UUIDs here: http://en.wikipedia.org/wiki/Uuid.

Please note that the UUID gem maintains a state file which is created in 
/var/tmp/ruby-uuid or the Windows common application data directory using mode 
0644. If that directory is not writable, the file is created as .ruby-uuid in 
the home directory. State files are not portable across machines. For more
information see: http://github.com/assaf/uuid/tree/master.

Options
=======
column      The database column to store the UUID value in.
format      One of the following (the default is :compact): 
                :compact  => '%08x%04x%04x%04x%012x', 
                :expanded => '%08x-%04x-%04x-%04x-%012x', 
                :urn      => 'urn:uuid:%08x-%04x-%04x-%04x-%012x'

Example
=======

class Customer < ActiveRecord::Base
  acts_as_universally_unique :column => :access_key
end

$ script/console
>> c = Customer.create!
>> c.access_key
=> ab57bba0e968012bf7e6002332b9705e

Copyright (c) 2009 Jason Fox, www.jasonfox.com, Released under the MIT license

acts_as_universally_unique's People

Contributors

jasonfox avatar

Stargazers

Angus H. avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.