Module: Persistence::Save

Included in:
Persistence
Defined in:
lib/persistence/save.rb

Instance Method Summary collapse

Instance Method Details

#save(object) ⇒ Object

Persists given object into database.

Parameters:

  • object (Object)

    Domain object

Returns:

  • (Object)

    Domain object



11
12
13
14
15
16
17
# File 'lib/persistence/save.rb', line 11

def save(object)
  if self.was_persisted?(object)
    self.persist_existing(object)
  else
    self.persist_new(object)
  end
end