Module: R

Included in:
ActiveRecord::Base
Defined in:
lib/r.rb

Overview

lib/r.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object


5
6
7
# File 'lib/r.rb', line 5

def self.included(base)
  base.extend ClassMethods
end

Instance Method Details

#ensure_unique(name) ⇒ Object


9
10
11
12
13
# File 'lib/r.rb', line 9

def ensure_unique(name)
  begin
    self[name] = yield
  end while self.class.exists?(name => self[name])
end