Module: Edr::AR::Repository

Includes:
Repository
Defined in:
lib/edr/ar/repository.rb

Instance Method Summary collapse

Methods included from Repository

#all, #delete, #delete_by_id, #find

Instance Method Details

#persist(model) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/edr/ar/repository.rb', line 6

def persist model
  data_object = data(model)
  data_object.save!

  model.id = data_object.id if model.respond_to?(:id)
  model.send(:repository=, self) if model.respond_to?(:repository, true)

  model
end