These are chat archives for dry-rb/chat

3rd
Jun 2016
Chase Gilliam
@Ch4s3
Jun 03 2016 00:55
yeah
John Backus
@backus
Jun 03 2016 04:19
k
Jeff Dickey
@jdickey
Jun 03 2016 04:29
@flash-gordon D'oh! Should have seen that! Thanks, @flash-gordon! Gist updated, including credit
Nikita Shilnikov
@flash-gordon
Jun 03 2016 07:48
@jdickey no problem, your gist was very helpful in reproducing the error, it took a couple of seconds, really
Jeff Dickey
@jdickey
Jun 03 2016 07:48
@flash-gordon cool; thanks again
Vladimir Dralo
@vladra
Jun 03 2016 16:41
hi guys
I’m new to dry-types and I’m wondering if it is possible to define custom type for ActiveRecords::Relation? I’m passing scope from controller to service, but not sure how to solve this
Piotr Solnica
@solnic
Jun 03 2016 18:46
@vladra could you tell me what are you trying to do? what would that type do?
Vladimir Dralo
@vladra
Jun 03 2016 18:52
@solnic I have a service, which requires scoped relation from controller (after applying specific scope permissions). It needs to be lazy, so query is not executed before I need to. So I have an ability to filter it further inside service. And I wanted to use dry-types to make sure that Relation/Scope is passed there or fail otherwise. But maybe I’m going in wrong direction and you can give me the tip on better approach
Piotr Solnica
@solnic
Jun 03 2016 18:53
types should deal with simple values, AR::Relation feels a bit too much
Vladimir Dralo
@vladra
Jun 03 2016 18:59
I see. Atm I’m overriding initializer, but just don’t like how it looks like. Thanks
Maciej Mensfeld
@mensfeld
Jun 03 2016 20:29
@mrbongiolo yeah but I would like to have a hard error failure on a case like that to be honest
otherwise for internal usage it will create silnet issues like "why the heck isn't a key in the return" - I use dry-validations to define an internal data exchange format