Module: InteractorSupport::Concerns::Updatable

Extended by:
ActiveSupport::Concern
Includes:
InteractorSupport::Core
Defined in:
lib/interactor_support/concerns/updatable.rb

Overview

Adds an update DSL method for updating a context-loaded model with attributes.

This concern allows flexible updates using data from the interactor's context. It supports direct mapping from context keys, nested attribute extraction from parent objects, lambdas for dynamic evaluation, or passing a symbol pointing to an entire context object.

This is useful for updating records cleanly and consistently in declarative steps.

Examples:

Update a user using context values

update :user, attributes: { name: :new_name, email: :new_email }

Extract nested fields from a context object

update :user, attributes: { form_data: [:name, :email] }

Use a lambda for computed value

update :post, attributes: { published_at: -> { Time.current } }

See Also:

Method Summary

Methods included from InteractorSupport::Core

included