mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-05 05:25:24 +02:00
Encapsulate enrichment actions, add tests
This commit is contained in:
parent
dd605a577e
commit
94a807c3c9
9 changed files with 149 additions and 71 deletions
|
@ -17,14 +17,11 @@ class Rule::ActionExecutor::SetTransactionMerchant < Rule::ActionExecutor
|
|||
end
|
||||
|
||||
scope.each do |txn|
|
||||
Rule.transaction do
|
||||
txn.log_enrichment!(
|
||||
attribute_name: "merchant_id",
|
||||
attribute_value: merchant.id,
|
||||
source: "rule"
|
||||
)
|
||||
txn.update!(merchant: merchant)
|
||||
end
|
||||
txn.enrich_attribute(
|
||||
:merchant_id,
|
||||
merchant.id,
|
||||
source: "rule"
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue