These are chat archives for dry-rb/chat

25th
Jul 2016
Terry Appleby
@tappleby
Jul 25 2016 01:03
Is it possible to do an intersection check w/ dry validations? I was using includes? but that can only match on a single value.
Kiril Dokh
@dsounded
Jul 25 2016 07:26
@solnic hello, mate, have you done with new release ?)
Wojciech Maciejak
@wmaciejak
Jul 25 2016 09:30

Hi! I have a small problem with a combine in my repository. Firstly I explain my situation. I have 3 tables:

hours(id, user_id)
users(id, organization_id)
organizations(id, name, code)

It’s very simplified, but it good explains situation. The main problem is with fetching hours. I need nest in tuple hours, objects user and object organization. It should look like this:

#<ROM::Struct[Hours] id=„xxx” user=#<ROM::Struct[User] id=„yyy” organization=#<ROM::Struct[Organization] id=„zzz” name=„name” code=„code”>>>

So I write this easy code:

hours.combine_parents(one: users)

But how I can put object organization inside users? I should write next combine like combine_parents(one: users.combine(…))?

Thanks for every advices!

Piotr Solnica
@solnic
Jul 25 2016 09:59
@wojtekmaciej yes this can be deeply nested
Wojciech Maciejak
@wmaciejak
Jul 25 2016 10:05
Okay, I will try, but It’s there any way to put organization entity explicitly into hours(not in users) ?
Piotr Solnica
@solnic
Jul 25 2016 10:45
@dsounded yes but not with the feature you need :(
Kiril Dokh
@dsounded
Jul 25 2016 10:45
:D
Piotr Solnica
@solnic
Jul 25 2016 10:45
I gotta push rom 2.0 first, not enough time for dry stuff atm
Kiril Dokh
@dsounded
Jul 25 2016 10:45
@solnic well, I see
Piotr Solnica
@solnic
Jul 25 2016 10:46
@dsounded I’ll give it another shot on Friday
Piotr Solnica
@solnic
Jul 25 2016 12:29
@wojtekmaciej yes, just do hours.combine_parents(one: users, one: organizations) and define Organizations#for_hours which will fetch the data and provide hour_id in resulting tuples
Wojciech Maciejak
@wmaciejak
Jul 25 2016 12:31
@solnic, Ahh, nice! Thanks for answer!
Jérémie Horhant
@Titinux
Jul 25 2016 14:25
Hi, I'm new with dry-configurable and I see how to add nested settings but is it possible to make an array of nested of nested properties ?
Andy Holland
@AMHOL
Jul 25 2016 14:26
@Titinux do you have an example of what you're trying to do?
Jérémie Horhant
@Titinux
Jul 25 2016 14:29
setting :v_file do
  setting :class
  setting :mime_type
  setting :children_mime_types
end
where the setting v_file is an array of objects with properties class/mime_type/children_mime_types
Andy Holland
@AMHOL
Jul 25 2016 14:32
@Titinux that isn't supported, I think it's a bit out of scope for dry-configurable, I'd just use an array of hashes personally
As I don't feel it would make sense to configure with config.v_file[0].class = ...
Jérémie Horhant
@Titinux
Jul 25 2016 14:33
ok. thanks.
Andy Holland
@AMHOL
Jul 25 2016 14:34
Also, class would break there as it would return "Dry::Configurable::Config"
So config.v_file << { class: '...', mime_type: '...', children_mime_types: [] } would probably make more sense
Vitaly Pushkar
@vitaly-pushkar
Jul 25 2016 15:51
@solnic which gems need most help at the moment? I really like this "movement" to small, polished libraries and would love to contribute
Andy Holland
@AMHOL
Jul 25 2016 16:08
@vitaly-pushkar cool that you want to help out :) Probably dry-validation and dry-types that command the most attention:
Russell Edens
@rx
Jul 25 2016 18:37
Hi I created a pull request against dry-component to support singleton's. dry-rb/dry-component#21 It's my first dry pull request. Let me know if you need anything more for it.
Piotr Solnica
@solnic
Jul 25 2016 19:05
@vitaly-pushkar pretty much every gem needs help :) poor little gems
@vitaly-pushkar validation/types/logic are the most complex ones
really depends on what you’re interested in
@rx thanks man, this was actually on my personal todo list for months
ie most of the objects we use can be singletons
like rom repos
Nikita Shilnikov
@flash-gordon
Jul 25 2016 19:11
I use a custom resolver with caching for this, but I don't use dry-component yet
Michał Warda
@michalwarda
Jul 25 2016 19:15
Hi guys, I have a small problem with dry-validation. I wanted to put it into my new rails app instead of Reform, as It should already fulfill all my needs. I wanted to use it with ActiveRecord though as a params validator / sanitizer. The only problem I have is that it doesn't remove the params that I didn't list in the schema. Is that the default behaviour? If so is there an option to do that? Or do I have to use ROM for that?
This message was deleted
Piotr Solnica
@solnic
Jul 25 2016 19:29
@michalwarda Schema.Form removes keys that were not listed, alternatively you can do Schema { configure { config.input_processor = :sanitizer } }
Michał Warda
@michalwarda
Jul 25 2016 19:38
@solnic Thanks a lot!
Piotr Solnica
@solnic
Jul 25 2016 19:43
we’re still considering turning this behavior on my default for all schemas