Module: Dry::Rails::Features::ControllerHelpers

Defined in:
lib/dry/rails/features/controller_helpers.rb

Overview

Controller helpers

Instance Method Summary collapse

Instance Method Details

#containerDry::Rails::Container

Return the application container



34
35
36
# File 'lib/dry/rails/features/controller_helpers.rb', line 34

def container
  Railtie.container
end

#resolve(key) ⇒ Object

Return a component from the application container

Examples:

def index
  users = resolve("users.index").(safe_params[:query])
  render json: users
end

Parameters:

  • key (Symbol, String)

    The component key

Returns:

  • (Object)

Raises:

  • Dry::Container::Error



25
26
27
# File 'lib/dry/rails/features/controller_helpers.rb', line 25

def resolve(key)
  container[key]
end