These are chat archives for dry-rb/chat

29th
Oct 2018
Piotr Solnica
@solnic
Oct 29 2018 11:08
@art-solopov hey, what's your use case?
Sean Winner
@swinner2
Oct 29 2018 16:43
@art-solopov I am also interested in your question. I’ve been co-locating the schema and the struct since the key names need to be duplicated. I validate the params then use the output to instantiate the struct.
schema = Form::Schema.call(params)
Form.new(schema.output)
Piotr Solnica
@solnic
Oct 29 2018 18:38
@swinner2 minor but : Form.new(schema.output) => Form.new(schema) because schema's result are coercible to a hash
Sean Winner
@swinner2
Oct 29 2018 18:49
:thumbsup: @solnic thanks. I’m assuming the new dry-schema will help pull these pieces together, right?
usually I have to use schema.output.merge(errors: schema.errors) to get the errors on the form object to cooperate with simple_form
Piotr Solnica
@solnic
Oct 29 2018 18:58
@swinner2 integrations with "form" helpers libs is a different topic actually