module Wallaby::Servicable

Servicer related attributes

Public Instance Methods

current_servicer() click to toggle source

Model servicer for current modal class. It comes from:

  • controller configuration {Wallaby::Servicable::ClassMethods#model_servicer .model_servicer}

  • a generic servicer based on {Wallaby::Servicable::ClassMethods#application_servicer .application_servicer}

@return [Wallaby::ModelServicer] model servicer @since wallaby-5.2.0

# File lib/concerns/wallaby/servicable.rb, line 53
def current_servicer
  @current_servicer ||=
    (controller_to_get(:model_servicer) \
      || Map.servicer_map(current_model_class, controller_to_get(:application_servicer))).try do |klass|
      Logger.debug %(Current servicer: #{klass}), sourcing: false
      klass.new current_model_class, current_authorizer, current_model_decorator
    end
end