How to load active_model_validations standard config option?
active_model_validationsstandard config option enablesvalidatesDSL for service result params validation viaactive_model.In order to load it, require
convenient_serviceand the extra.require "convenient_service" require "convenient_service/extras/standard/config/options/active_model_validations"When config with
.with(:active_model_validations)is used, services can utilizevalidates.class Service include ConvenientService::Standard::Config.with(:active_model_validations) attr_reader :foo validates :foo, presence: true def initialize(foo:) @foo = foo end def result success end end Service.result(foo: nil) # => <Service::Result status: :error, data_keys: [:foo], message: "foo can't be blank"> Service.result(foo: :bar) # => <Service::Result status: :success>