docs/receiving.md in table_sync-5.0.0 vs docs/receiving.md in table_sync-5.1.0

- old
+ new

@@ -66,11 +66,11 @@ - `to_table` - destination table name (required if not set to_model) - `to_model` - destination model (required if not set to_table) - `events` - array of supported events (optional) - `block` - configuration block with options (optional) -This method implements logic of mapping `source` to `to_table` (or to `to_model`) and allows customizing +This method implements logic of mapping `source` to `to_table` (or to `to_model`) and allows customizing the event handling logic with provided block. You can use one `source` for a lot of `to_table` or `to_moel`. ### Options: @@ -233,16 +233,17 @@ #### wrap_receiving Proc that is used to wrap the receiving logic by custom block of code. ```ruby -wrap_receiving do |data:, target_keys:, version_key:, default_values: {}, &receiving_logic| +wrap_receiving do |data:, target_keys:, version_key:, default_values: {}, event:, &receiving_logic| receiving_logic.call return makes no sense end ``` +event option is current fired event default value is `proc { |&block| block.call }` #### before_update Perform code before updating data in the database. @@ -260,19 +261,21 @@ #### after_commit_on_update Perform code after updated data was committed. ```ruby -after_commit_on_update do |data:, target_keys:, version_key:, default_values:| +after_commit_on_update do |data:, target_keys:, version_key:, default_values:, results:| return makes no sense end -after_commit_on_update do |data:, target_keys:, version_key:, default_values:| +after_commit_on_update do |data:, target_keys:, version_key:, default_values:, results:| return makes no sense end ``` +- `results` - returned value from `model.upsert` + Сan be defined several times. Execution order guaranteed. #### before_destroy Perform code before destroying data in database. @@ -290,17 +293,19 @@ #### after_commit_on_destroy Perform code after destroyed data was committed. ```ruby -after_commit_on_destroy do |data:, target_keys:, version_key:| +after_commit_on_destroy do |data:, target_keys:, version_key:, results:| return makes no sense end -after_commit_on_destroy do |data:, target_keys:, version_key:| +after_commit_on_destroy do |data:, target_keys:, version_key:, results:| return makes no sense end ``` + +- `results` - returned value from `model.destroy` Сan be defined several times. Execution order guaranteed. ### Custom model You can use custom model for receiving.