< 2.1.1 Operation Documentation

This page contains documentation for deprecated features of the activity gem suite that have been superseded.

While everything described here is still working, we encourage you to slowly replace your old code with the functions we think are more useful, usually faster, plus better to debug and understand.

Variable mapping

Input / Output

With trailblazer-2.1.1 and the bundled trailblazer-activity-dsl-linear-1.0.0 gems, the recommended way of I/O is using composable variable mapping via In() and Out().

Before the introduction of the composable In(), Out() and Inject() filters, variable mapping was done with the :input and :output option. This is still supported and not planned to be dropped. However, there are a bunch of drawbacks with using the monolithic, non-composable options.

  • Once used, the :input, :output and :inject option will overwrite any options set earlier (or later) via In(), Out() and Inject(). This will often lead to problems when using macros.
  • The superseded options are basically impossible to debug, whereas the composable In() approach can nicely display the computed set of variables going in or out of a step.
  • In future versions of Trailblazer we’re planning automatic “contracts” for steps along with type checking. This is not possible with the monolithic :input option.

Input / Output :input

The :input option accepts any callable following the option interface.

step :create_model,
  input: :input_for_create_model
  # becomes
  In() => :input_for_create_model

:input works identically to a single In() call.

Input / Output :output

The :output option, just like :input, accepts any callable following the option interface.

step :create_model,
  output: :output_for_create_model
  # becomes
  Out() => :output_for_create_model

:output works identically to a single Out() call.

The :output_with_outer_ctx option is documented here.

step :create_model,
  output: :output_for_create_model,
  output_with_outer_ctx: true
  # becomes
  Out(with_outer_ctx: true) => :output_for_create_model

Input / Output :inject

:inject works identically to a single Inject() call.

step :create_model,
  inject: :inject_for_create_model
  # becomes
  Inject() => :inject_for_create_model

Dependency Injection

WIP: This section is not final, yet.


Very often your activity or one of the steps contained require particular objects and values to get their job done. Instead of hard-wiring those “dependencies” in the code it is good style to allow providing those objects by passing them into the activity at run-time. This is called dependency injection and is a common technique in software engineering.

One way for using dependency injection is using keyword arguments for variables you need, and defaulting those in the step signature.



Dry container


defaulting in macros

Wiring API

Path() dsl < 1.2.0

Path() end_task/end_id

In older versions before trailblazer-activity-dsl-linear-1.2.0, connecting the Path() to a separate terminus required you to pass two options :end_task and :end_id.

Output(...) => Path(
  end_task: :valid),
  end_id:   "End.valid") do
  # ...

This is now simplified to be more consistent by introducing the :terminus option.

Output(...) => Path(terminus: :valid) do
  # ...

If you haven’t updated your code you will see a deprecation warning.

[Trailblazer] <file.rb> Using `:end_task` and `:end_id` in Path() is deprecated, use `:terminus` instead.
  Please refer to

Dependency Injection

Overview Mapping Dry container

Wiring API

Path() end_task/end_id