These are chat archives for dry-rb/chat

12th
Sep 2016
Kiril Dokh
@dsounded
Sep 12 2016 06:41
Hello, @solnic , could you please link once again who is maintainer of monads gem ?
Piotr Solnica
@solnic
Sep 12 2016 06:45
@dsounded that would be @flash-gordon
Kiril Dokh
@dsounded
Sep 12 2016 06:52

@solnic @flash-gordon could you take a look ?

https://github.com/dry-rb/dry-monads/pull/22/files

Alexander Gräfe
@rickenharp
Sep 12 2016 07:35
Is there a way to define a rule, so that you only get one error? required(:foo).filled(included_in?: ['a', 'b']) on nil sets 2 errors on :foo. Or am I "doing it wrong" wanting to only get the "not filled" error?
Piotr Solnica
@solnic
Sep 12 2016 08:25
@rickenharp in 0.10.0 there's errors and hints methods on result object. This will do what you want
Alexander Gräfe
@rickenharp
Sep 12 2016 08:25
@solnic Cool, I'll have a look, thanks
Piotr Solnica
@solnic
Sep 12 2016 08:30
(Not released yet)
Alexander Gräfe
@rickenharp
Sep 12 2016 08:31
Then I will have a look...later ;)
Piotr Solnica
@solnic
Sep 12 2016 08:52
Should be released around wed/thu
Christopher Dennl-Ortega Arrieta
@cdennl
Sep 12 2016 09:15
are there api changes @solnic or just new features?
Alexander Gräfe
@rickenharp
Sep 12 2016 09:34
I am a bit confused about validations. If I have an optional value, that, if present, should have a certain format, wouldn't optional(:name).filled(format?: /^[A-Za-z]+$/) be the way to validate that?
Christopher Dennl-Ortega Arrieta
@cdennl
Sep 12 2016 09:52
optional key or optional value?
@rickenharp
Alexander Gräfe
@rickenharp
Sep 12 2016 10:17
@cdennl The value is optional.
Alexander Gräfe
@rickenharp
Sep 12 2016 10:24
Ah, found the error. Forgot to define the property on the form object.
Christopher Dennl-Ortega Arrieta
@cdennl
Sep 12 2016 11:00
@rickenharp optional values are not defined with filled, but maybe
@rickenharp so you want either optional(:name).maybe oder required(:name).maybe
@rickenharp but not all cases are qorking correctly with reform atm
Rafael George
@cored
Sep 12 2016 18:26
hi all
I'm building a form object with virtus which is great for it
my question is related to injecting dependencies for handling persistence logic
don't know if the best approach is to just hard code the constant directly in my persist! method. I really don't like that approach because it will tight that object to the model. Is there a way for me to pass an active recodr model to my virtus form object? I tried by defining attribute :company, Object and then at initialization passing the actual model with new(company: company)
but is not working
don't know if this is the proper chat to talk about virtus
Russell Edens
@rx
Sep 12 2016 21:27
@solnic pushed (finally) WIP for a dry-metadata that returns field level metadata from dry-v and dry-s: https://github.com/dry-rb/dry-validation/issues/67#issuecomment-246497364 It still needs to be updated for the new dry-l ast changes. But I thought I'd get it pushed before diving into that.