Sha256: 799d084b117ec675c772fa7a59c137b72b2294132d969edbc2b49de82f979ca9
Contents?: true
Size: 674 Bytes
Versions: 8
Compression:
Stored size: 674 Bytes
Contents
# from Demetrio Nunes # Modified by Andy Singleton to use different GUID generator # # MIT License require 'uuid22' module ActiveRecord module Usesguid #:nodoc: def self.append_features(base) super base.extend(ClassMethods) end module ClassMethods def usesguid(options = {}) class_eval do set_primary_key options[:column] if options[:column] def after_initialize self.id ||= UUID.timestamp_create().to_s22 end end end end end end ActiveRecord::Base.class_eval do include ActiveRecord::Usesguid end
Version data entries
8 entries across 8 versions & 1 rubygems