Class: EasyRecord

Inherits:
Object
  • Object
show all
Extended by:
Association
Defined in:
lib/easy_record.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Association

belongs_to, has_many

Constructor Details

#initialize(args = nil) ⇒ EasyRecord

private



24
25
26
27
# File 'lib/easy_record.rb', line 24

def initialize(args = nil)
  Record.track(self)
  @id = Index.next_id(self)
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



8
9
10
# File 'lib/easy_record.rb', line 8

def id
  @id
end

Class Method Details

.allObject



10
11
12
# File 'lib/easy_record.rb', line 10

def self.all
  Record.of(self.to_s)
end

.firstObject



14
15
16
# File 'lib/easy_record.rb', line 14

def self.first
  self.all.first
end

.lastObject



18
19
20
# File 'lib/easy_record.rb', line 18

def self.last
  self.all.last
end