These are chat archives for dry-rb/chat

21st
Jul 2018
siassaj
@siassaj
Jul 21 2018 07:26
hey so
what happenede that dry-container was built/
it's a concept that I'd never thought of, what was the use case that motivated it ?
Nikita Shilnikov
@flash-gordon
Jul 21 2018 18:33
@siassaj I guess it's covered at http://dry-rb.org/gems/dry-container/
Sean Winner
@swinner2
Jul 21 2018 19:31
ActiveModelErrorsInstance = Instance(ActiveModel::Errors)
    attribute :errors, Types::ActiveModelErrorsInstance.constructor { |error_hash|
      errors = ActiveModel::Errors.new(self)

      error_hash.each do |key, value|
        value.each do |message|
          errors.add(key, message)
        end
      end

      errors
    }.default { ActiveModel::Errors.new(self) }
Am I doing this right? :smile:
Just wanted to share this here I’m using this to be able to use a dry-struct with simple_form
The error hash is coming from dry-validation schema errors