Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 11:52
    flash-gordon commented #361
  • 07:09
    unixc3t starred dry-rb/dry-types
  • Oct 22 22:33
    patrickclery commented #361
  • Oct 22 21:12
    D1mon starred dry-rb/dry-matcher
  • Oct 22 15:44
    graudeejs starred dry-rb/dry-container
  • Oct 22 08:41
    esparta commented #366
  • Oct 22 08:39
    flash-gordon commented #366
  • Oct 22 08:39

    flash-gordon on master

    Fix error on Dry::Types::Array#… Merge pull request #366 from es… (compare)

  • Oct 22 08:39
    flash-gordon closed #366
  • Oct 22 08:38
    flash-gordon closed #362
  • Oct 22 08:38
    flash-gordon commented #362
  • Oct 22 08:37
    flash-gordon closed #361
  • Oct 22 08:37
    flash-gordon commented #361
  • Oct 22 07:48

    solnic on master

    Adding missing built-in predica… Merge pull request #65 from esp… Merge branch 'release-1.0' (compare)

  • Oct 22 07:47

    solnic on release-1.0

    Adding missing built-in predica… Merge pull request #65 from esp… (compare)

  • Oct 22 07:47
    solnic closed #65
  • Oct 22 07:29
    esparta opened #65
  • Oct 22 07:06
  • Oct 22 06:23
    robturtle starred dry-rb/dry-monads
  • Oct 22 05:15
    Travis esparta/dry-types (array_try_specs) passed (4)
Piotr Solnica
@solnic
happy to clarify, just ask
I used dry-container/auto-inject in a rails app, see my rom-rails-skeleton on github
but I haven't used dry-component in a rails app, no idea if it will Just Work™ in its current form
Alexander Gräfe
@rickenharp
The biggest hurdle at the moment is instantiating something you get out of dry-container with parameters. Something like Container[’validate’](String) or Container[’validate’](Array)
Piotr Solnica
@solnic
what's validate there?
Alexander Gräfe
@rickenharp
It’s a dry-transaction step that should validate its input against the given class. I told them to use explicit StringValidator and ArrayValidator steps, but apparently that is ‘too much typing'
Basically, I am doing damage control at the moment :D
Piotr Solnica
@solnic
what kind of parameters does it need?
Alexander Gräfe
@rickenharp
I don’t quite understand that question, sorry. :(
Piotr Solnica
@solnic
you said you're getting objects from the container with parameters
Alexander Gräfe
@rickenharp
Yes, they used dry-component to define the step objects, and since those are auto-registered, they can’t influence the instantiation of those step objects.
Piotr Solnica
@solnic
if you need custom instantiation logic, register objects yourself
I understand you're dealing with existing legacy objects?
Alexander Gräfe
@rickenharp
Yes, allthough a lot of that legacy was an ad-hoc implementation of dry-transaction functionality.
Piotr Solnica
@solnic
you can also override .new and put custom logic there
in general, we're trying to promote objects that don't need any state except external dependencies and/or configuration
so ie we don't do Validator.new(data).call and instead just v=Validator.new;v.call(data)
Alexander Gräfe
@rickenharp
Yeah, that’s what I have gathered. But try selling that to people who are buried deep in the Rails Way… :sigh:
Piotr Solnica
@solnic
so object graphs that are being created and exposed by the container don't hold data-as-state
well, that's OO way, not just Rails :)
it's hard to get out of this mindset, been there done that ;)
separating data from logic was one of the greatest improvements for me lately
Alexander Gräfe
@rickenharp
It’s not even OO, because the people I deal with don’t like having ‘all those classes’.
Piotr Solnica
@solnic
yeah I hear you, it's a common attitude "more concepts, too complicated", but it's only an impression
Nikita Shilnikov
@flash-gordon
I came to this after reading four books about clojure :)
Piotr Solnica
@solnic
I started doing that in ruby along with ditching mutable objects, so it was a natural consequence
Alexander Gräfe
@rickenharp
I’m avoiding learning more about other programming languages until after this project, it would just make me sad… :D
Piotr Solnica
@solnic
then I started looking into clojure and my thinking about this became less blurred :)
the trouble with data/logic in OO was that people treated data as something messy, so hiding it behind objects that "just send messages" was supposed to safe you from having to deal with that messy data
the problem with objects "just sending messages" is that it's really hard to compose functionality
you end up with complex inheritance hierarchies, object decorators etc
and it's still not really flexible
application-specific data structures are as pleasant to work with as your objects, the trick is to be able to have these data structures in the first place (hint: rom-rb)
if your app is working with raw representation of the data that comes directly from your db, then it's gonna be messy (hint: Active Record)
Tomek Rusiłko
@rusilko
Hey, I’ve looked around a bit in dry-* space and have few questions/observations regarding dry-validations-rails integration thingy (pls don’t mind if some are super obvious):
  1. dry-v library would shine mostly as a replacement for AM validations, since that’s where validation logic is used.
  2. Strong params is just a whitelisting of attributes without rule checking, just require/permit kinda thing, right?
  3. I understand we want to keep them separated, that is validation in models and whitelisting in controllers?
  4. Or maybe we actually want to pull out validation logic from models and do the validation in the service called from controller directly (using dry-v below ofc)? In such a case maybe it could be combined with strong params functionality?
  5. In any case the question is that if a dev uses dry-v for strong params it would seem strange not to use it for model validations as well… which bring us to the questions of where to put the Schemas and should they be duplicated for strong params / validations ?
  6. From more formal standpoint - we want to do it as a separate gem (sorry, no knowledge in this space)
  7. Should we create a separate chatroom here (less noise)?
  8. @solnic - why “dry-*”? where is this name coming from? Just curious :)
Chase Gilliam
@Ch4s3
@rusilko I think the idea is that some of us are about to start writing a dry-validation-rails
and to your last point I think it comes from the phrase "Do not Repeat Yourself"
Tomek Rusiłko
@rusilko
@Ch4s3 yes, that’s why I am here, I want to help :) My main question is wheter we (or someone) is writing one dry-validation-rails gem to cover both model validations and strong params or rather two separate things?
Chase Gilliam
@Ch4s3
I don't think we've nailed down scope yet
there's room for everyone, so stay tuned in the channel
:)
Tomek Rusiłko
@rusilko
awesome, thx
Tomek Rusiłko
@rusilko
how is “nailing down scope” happening usually, do you guys discuss everything here?
Chase Gilliam
@Ch4s3
yeah, basically all of the discussion happens here
Piotr Solnica
@solnic
@rusilko I'm busy with work so I'll answer all questions later, re why dry - we just wanted something short ;)
Tomek Rusiłko
@rusilko
cool, I gotta run too, talk ty later
Aleksandar Radunović
@aradunovic
is there some rule of thumb when deciding if something should be a separate transaction step or just included into some operation?
take validation for example…do you validate in CreateSomething operation or define it as a :validate step in transaction?
Ralf Schmitz Bongiolo
@mrbongiolo
maybe dry-v could be used in a similar way that Hanami uses it on its actions, it acts like strong_parameters + validator
Chase Gilliam
@Ch4s3
That could be good
Tim Riley
@timriley
@aradunovic I tried validations as standalone steps in transactions but found it was a level of granularity that wasn’t helping. Our most common commands are mostly built around validate+persist and it made sense to combine them. The validation feels closely related to preparing the data for persistence.