1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-18 20:59:39 +02:00
Maybe/app/models/rule/action_executor/set_transaction_name.rb
2025-05-20 11:33:35 -04:00

26 lines
480 B
Ruby

class Rule::ActionExecutor::SetTransactionName < Rule::ActionExecutor
def type
"text"
end
def options
nil
end
def execute(transaction_scope, value: nil, ignore_attribute_locks: false)
return if value.blank?
scope = transaction_scope
unless ignore_attribute_locks
scope = scope.enrichable(:name)
end
scope.each do |txn|
txn.entry.enrich_attribute(
:name,
value,
source: "rule"
)
end
end
end