Sha256: 22844c95a9f5428ca6c6f69981fc14bad748238bb5f9085312aae5750a5923f6
Contents?: true
Size: 426 Bytes
Versions: 7
Compression:
Stored size: 426 Bytes
Contents
# Patches ActiveRecord models to use UUID based IDs instead of the default numeric ones require 'uuidtools' # Extends ActiveRecord models with UUID based IDs module RestfulX module UUIDHelper def self.included(base) base.class_eval do before_create :generate_uuid end end def generate_uuid self.id = UUIDTools::UUID.random_create.to_s.gsub("-", "") unless self.id end end end
Version data entries
7 entries across 7 versions & 4 rubygems