Sha256: 48caeeb2dbea54fad15f491c428ee20f7a9b3017aaca68ad461fd523348a9cf5

Contents?: true

Size: 1.14 KB

Versions: 1

Compression:

Stored size: 1.14 KB

Contents

---
id: overview
title: Overview
---

In [the basic example](basic_example.md), you can see that Clowne consists of flexible DSL which is used in a class inherited of `Clowne::Cloner`.

You can combinate this DSL via [`traits`](traits.md) and make a cloning plan which exactly you want.

**We strongly recommend [`write tests`](testing.md) to cover resulting cloner logic**

Cloner class returns [`Operation`](operation.md) instance as a result of cloning. The operation provides methods to save cloned record. You can wrap this call to a transaction if it is necessary.

## Execution Order

The order of cloning actions depends on the adapter (i.e., could be customized).

All built-in adapters have the same order and what happens when you call `Operation#persist`:
- init clone (see [`init_as`](init_as.md)) (empty by default)
- [`clone associations`](include_association.md)
- [`nullify`](nullify.md) attributes
- run [`finalize`](finalize.md) blocks. _The order of [`finalize`](finalize.md) blocks is the order they've been written._
- run [`after_clone`](after_clone.md) callbacks
- __SAVE CLONED RECORD__
- run [`after_persist`](after_persist.md) callbacks

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
clowne-1.1.0 docs/overview.md