These are chat archives for dry-rb/chat

26th
Jan 2018
Sean Collins
@cllns
Jan 26 2018 17:42
I’m using Dry::Validation.Formin an interactor (a PORO, no gem) in order to avoid accepts_nested_attributes_for. Basically I don’t want to tie the form to the implementation of the associations, so the form is all under the same key (user). Right now I’m using the Dry::Validation.Form, but in order to update the association properly, I’m using Hash#slice to pull out the keys I want for the main object, and for the associated object, separately. Anyone have any better approaches? It seems OK but there’s a little bit of duplicated/redundant logic, with all the key names being listed twice: once in the Form, and then sliceing the validated params.