Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
Piotr Solnica
@solnic
The only trick is lib/berg/repository.rb with the overidden constructor to workaround one issue, although I am not even sure if we still need it O_o /cc @timriley
Juanma Cervera
@jmcervera
@solnic Thank you. I'll fo it
I'll do it
Piotr Solnica
@solnic
@Kukunin no need to use container for structs. Just use global struct classes
Nikita Shilnikov
@flash-gordon
@solnic structs are being registered automatically here https://github.com/dry-rb/dry-struct/blob/master/lib/dry/struct/class_interface.rb#L30
Piotr Solnica
@solnic
Yes they are, not sure if we still need it though??
Nikita Shilnikov
@flash-gordon
no idea :)
at least we could check if a struct has a custom/constant name
Piotr Solnica
@solnic
I gotta revisit this. I did it in the very early days (dry-data days) so it is very likely we don't really need this anymore
Sergey Kukunin
@Kukunin
@solnic hey. do you want me to create issue for dry-struct gem about container use?
Piotr Solnica
@solnic
@Kukunin yes pls. In general whenever you see that something is problematic or just confusing pls report either an issue or post your question on discuss.dry-rb.org
We're trying to shift use support to issues/discuss rather than doing it here
Somebody posted this today. Some comments are a bit sad though
Nikita Shilnikov
@flash-gordon
@solnic TOO MANY RELEASES
just stop doing that
Piotr Solnica
@solnic
E_TOO_MANY_RELEASES
Don Morrison
@elskwid
:heart:
Piotr Solnica
@solnic
FWIW the comment felt trollish but I replied anyway :)
John Backus
@backus
@solnic I dug up our old chat and I'll move forward with this https://gitter.im/dry-rb/chat?at=57686358feaf6cd222ad7e15
John Backus
@backus
Going to have to start with a series of PRs to dry-types
Piotr Solnica
@solnic
@backus fantastic!
John Backus
@backus
@solnic I opened dry-rb/dry-types#133 as the first of many small PRs
Juanma Cervera
@jmcervera

Trying to setup a dry-system project that uses ROM.
I has followed the berg project, as advised, although this is not a web project.
I can't get it working, I can't access the repositories and objects I'm trying to register in the container.
Maybe I'm registering them incorrectly or failing to getting them back after that. I don't know.
Could someone give a one-minute glance to the project and tell what I'm doing wrong?

https://github.com/jmcervera/rom-dry-system

Thank you very much.

Aleksandar Radunović
@aradunovic
@jmcervera you have a typo here. It’s persistence instead of persistance. Also, here you should use schema(:users, infer: true) do. see infer: docs. It works for me after applying these changes.
@solnic Is there a reason why some keys are not showing when Dry::System::Container.keys is used, even though the dependency has been booted?
Piotr Solnica
@solnic
@aradunovic depends on what this boot file is doing
Aleksandar Radunović
@aradunovic
@solnic it’s a simple definition of ROM relation class, from @jmcervera example above.
Piotr Solnica
@solnic
I'll check it out later. Traveling atm
John Backus
@backus
@flash-gordon when you're available we should talk about dry-rb/dry-types#137 and dry-rb/dry-types#135
Yuji Yokoo
@yujiyokoo
This message was deleted
@timriley thanks, I've just read the discussion on errors vs hints. It makes sense to me now :)
Tim Riley
@timriley
Cool :)
John Backus
@backus
@solnic or @flash-gordon I've got dry-rb/dry-types#133, dry-rb/dry-types#134, and dry-rb/dry-types#135 ready to go. I'd like to work on refactoring the hash schemas but I'm already about 28 (smallish) commits ahead of master so it would be nice to get some of this reviewed and merged
Nikita Shilnikov
@flash-gordon
@backus, at the end of the day probably
Aleksandar Radunović
@aradunovic
Is it considered a bad practice to return Left(nil) when using Either monad?
Nikita Shilnikov
@flash-gordon
I think you want to use Maybe instead
Aleksandar Radunović
@aradunovic
@flash-gordon I thought about it, but I actually don’t care about the result on failure
Juanma Cervera
@jmcervera
@aradunovic , thanks for your help. I'm beginning to see the light.
Now I can access repositories from the container, but I can't get access to the relations. I thought they were registered also because they were in the lib directory. The same problem with entities. Am I missing something?
Piotr Solnica
@solnic
@jmcervera oh, no no, we didn’t integrate dry-system with rom yet so relations, commands and mappers are available through rom container so ie rom.relations[:your_relation]
I do plan to integrate rom with dry-container/system/auto_inject at some point though
Juanma Cervera
@jmcervera
@solnic. Ahh. thank you I was stuck with all these things
Juanma Cervera
@jmcervera
Well, I'm working against a legacy database.
As soon as I configure ROM, it seems that I have autodefined all the relations in the database. so what's the point of defining this relations as standalone classes?
Piotr Solnica
@solnic
you can think of relations as your data access layer, and repositories as your domain-specific data access layer, where you can instantiate custom objects, and load complex aggregates
Juanma Cervera
@jmcervera
@solnic. I have read it, and define some, using less fields that the actual table, but they are not uses by the repository, it seems to uses all the fields.
How are the relations attached to the ROM container?
Piotr Solnica
@solnic
@jmcervera oh if you want to change default dataset logic you need to use dataset with a block, we should probably default to schema attributes though
@jmcervera during setup rom builds initial relation objects and stores them in its container
so when you configure auto-registration in rom config, it’s gonna require your relation classes and use them