These are chat archives for dry-rb/chat

22nd
Jun 2018
Chris Richards
@cmrichards
Jun 22 2018 08:33
Also wondering how ROM would fit into this code.
Tim Riley
@timriley
Jun 22 2018 08:50
@cmrichards maybe you could tell us what worries you about that code?
Chris Richards
@cmrichards
Jun 22 2018 11:24

I'm not sure if I should be directly accessing the ActiveRecord objects here to create new objects, e.g.

quote_group.quote_items.active.create!(..

I'm not really sure where else this should go. I wonder if it would be better to centralise the all code that uses ActiveRecord objects like this, or if it's safe enough to live here. Perhaps there is a cleaner way using rom?

Also, I wonder if this:

def call(attempt_id:, test_ids:, quote_group_id:)
  result = Schema.({
    attempt_id: attempt_id,
    test_ids: test_ids,
    quote_group_id: quote_group_id,
  })

should be this:?

def call(args)
    result = Schema.(args)
Chris Richards
@cmrichards
Jun 22 2018 12:51
The dry- libraries are truly excellent libraries. I'm not sure how I ever lived without dry-validation/struct! I'd love to contribute financially somehow. Maybe a book is on the way?