Sha256: 921686695253de8e0150b9d1bdad809ac4c125d69d24dfeb877cd8ab55a3997b
Contents?: true
Size: 857 Bytes
Versions: 1
Compression:
Stored size: 857 Bytes
Contents
require_relative 'uniq_identifier/railtie' if defined?(Rails) require_relative 'uniq_identifier/hook' require_relative 'uniq_identifier/configure' module UniqIdentifier extend Configure def uniq_identifier(auto: true, validate: true, generator: :default) @uniq_identifier_generator = generator class << self def uniq_identifier_generator generator = @uniq_identifier_generator if generator.nil? && superclass.respond_to?(:uniq_identifier_generator) superclass.uniq_identifier_generator elsif generator == :default UniqIdentifier.configuration.generator else generator end end end if auto before_validation :set_uniq_identifier include Hook end if validate validates :uuid, presence: true, uniqueness: true end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
uniq_identifier-0.1.1 | lib/uniq_identifier.rb |