Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Oct 23 22:22
    patrickclery edited #362
  • Oct 23 22:21
    patrickclery commented #361
  • Oct 23 22:11
    patrickclery commented #361
  • Oct 23 22:11
    patrickclery commented #361
  • Oct 23 15:43
    FioFiyo starred dry-rb/dry-types
  • Oct 23 11:52
    flash-gordon commented #361
  • Oct 23 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)

Hannes Nevalainen
@kwando
When you can use your own types and coercions this will be event sweeter =)
when/if
Piotr Solnica
@solnic
you can
no public API for that yet though, but it’s possible
it’s only a matter of registering your type within dry-data and defining your predicate
…and extending type compiler, but we can collapse those 3 steps into a single method call
and extending type compiler means adding your_predicate => your_type mapping :joy:
sounded so serious when I wrote it :D
Hannes Nevalainen
@kwando
oh? you're spoiling us <3
Piotr Solnica
@solnic
dry-data is extendible, so is dry-validation
Hannes Nevalainen
@kwando
I don't really like the globalness of Dry::Data right now
Piotr Solnica
@solnic
yeah, I will probably add a way of setting your own container
I also thought about having a way to define types under constants, so it feels more natural to define things like attribute :foo, MyTypes::Something::Foo
but I dunno, we’ll see
Hannes Nevalainen
@kwando
cool =)
feels like you have a plan for everything =P
Piotr Solnica
@solnic
I certainly don’t, but I’ve thought about a ton things, I gotta say :)
@kwando ^^ :)
@AMHOL ^^
lemme know if you have some dsl ideas for that
we definitely need a way to explicitly name a group, which will be needed for messages, although this could default to concatenation of rule names within a group
eventually this will be nestable too, ie a group depending on another group etc
it should also be possible to create a group from rules that are applied to values from different levels of nesting
Piotr Solnica
@solnic
if you think that’s crazy, I can assure you this kind of requirements exist :joy: I’ve got a ton of this stuff in my current client project
Andy Holland
@AMHOL
@solnic I don't get what group is doing differently? Is it that it's calling an existing predicate with the values from two keys?
Group seems a bit of a strange name for that
Hannes Nevalainen
@kwando
I not sure about the name, but the functionality :thumbsup:
Piotr Solnica
@solnic
@AMHOL it groups rules so...
I mean I’m open to other names of course
the rule is called Rule::Group and is identified as :group because it is a…group :)
Andy Holland
@AMHOL
Just looks like an eql predicate in the spec
Piotr Solnica
@solnic
it accepts multiple args as input, so it’s different
we could just use rule(eql?: [:pass, :confirm]) maybe
Tim Riley
@timriley
That one reads better to me.
Piotr Solnica
@solnic
cool, I think I like it more
Tim Riley
@timriley
If I saw the word “group” used in a validation schema, I’d expect it to allow a disparate set of predicates (on multiple keys, even) that would all need to pass together, or something.
Andy Holland
@AMHOL
Yeah, rule works nicely IMO, much less confusing
Piotr Solnica
@solnic
Class.new(Dry::Validation::Schema) do
  confirmation(:password)
end
cannot be more concise than this :joy:
Andy Holland
@AMHOL
:)
Piotr Solnica
@solnic
@AMHOL btw, uniqueness validation backed by a db should be very simple to achieve now
Andy Holland
@AMHOL
Nice, guess it will still need a global connection?
Piotr Solnica
@solnic
basically include App::Import(‘persistence.relations.users’) and def unique?(key, value); users.unique?(key => value);end
injected from container
Andy Holland
@AMHOL
Ahh OK, so we need to make a new predicate for each unique constraint, makes sense :+1:
Piotr Solnica
@solnic
@AMHOL well, it’s just a key rule
Andy Holland
@AMHOL
Could probably do some hocus pocus to make a generic one, but would probably be a bad idea
Piotr Solnica
@solnic
key(:email, &:unique?) will partially apply :email to the predicate
then value will be passed