Module: Uniquify::ClassMethods

Defined in:
lib/uniquify-uuid.rb

Instance Method Summary collapse

Instance Method Details

#uniquify(*args, &block) ⇒ Object



15
16
17
18
19
20
# File 'lib/uniquify-uuid.rb', line 15

def uniquify *args, &block
  args.each do |name|
    block = Proc.new { Uniquify::UUID.generate } unless block_given?
    before_create { |record| record.ensure_unique(name, &block) }
  end
end