Class: Clarc::RepositoryBase

Inherits:
Object
  • Object
show all
Defined in:
lib/clarc/repository_base.rb

Class Method Summary collapse

Class Method Details

.allObject



4
5
6
# File 'lib/clarc/repository_base.rb', line 4

def all
  wrap(persistance_class.all)
end

.find(id) ⇒ Object



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

def find id
  wrap(persistance_class.find(id))
end

.save(model) ⇒ Object



12
13
14
15
16
17
# File 'lib/clarc/repository_base.rb', line 12

def save model
  persisted = persistance_class.new(model.to_hash)
  result = persisted.save
  model.id = persisted.id
  result
end