Skip to content

Interactor

Sunny Ripert edited this page Jan 17, 2026 · 7 revisions

This gem is heavily influenced by Interactor ♥.

Differences

Some key differences make Actor unique:

  • Defaults to raising errors on failures: actor uses call and result instead of call! and call. This way, the default is to raise an error and failures are not hidden away because you forgot to use !.
  • Requires documenting arguments with input and output.
  • Shorter setup syntax: inherit from < Actor vs having to include Interactor + include Interactor::Organizer.
  • Shorter syntax when calling the context: foo vs context.foo, self.foo = vs context.foo = , fail! vs context.fail!.
  • No before & after hooks, prefer using play.
  • Does not hide errors when an actor fails inside another actor (finally fixed in Interactor).

As well as these extra features:

  • Can add defaults to inputs.
  • Can add type checking to inputs.
  • Can add requirements and conditions on inputs.
  • Can use lambdas and instance methods in an organizer.
  • Can call interactors multiple times inside organizers.
  • Can add conditions to interactors in an organizer.
  • Allows early success with organizer conditions.

Migrating from Interactor

Actor accepts using Interactor classes when using play for a smooth migration. You can use both gems at the same time in your application.

Clone this wiki locally