Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
Piotr Solnica
@solnic
so I’m taking those use cases into consideration already
Andy Holland
@AMHOL
Ahh, OK, cool :)
Piotr Solnica
@solnic
@AMHOL mergy-mergy? :joy:
Hannes Nevalainen
@kwando
@solnic should one prefer call_sheet over transflow? Seems to be quite similar
Piotr Solnica
@solnic
I pushed i18n branch to dry-validation, gonna “prepare the ground” there, maybe add some super basic functionality too, happy to get some help later on with it /cc @AMHOL @Bartuz
lots of things to consider, so I’ll open a PR early so we could discuss in async mode too
Andy Holland
@AMHOL
@solnic not sure what you think, but we could avoid symbolize_keys by using :key: value in YAML files?
Piotr Solnica
@solnic
more typing in yaml, I think it’s valuable to simply convert to symbols, it’s not too complex
alternatively we could lookup by strings
Andy Holland
@AMHOL
That could work
Then we can use a namespace separator like in dry-container/i18n
Symbolize keys is complicated when it comes to nested arrays of hashes and stuff
Piotr Solnica
@solnic
I’ve NO IDEA how to use I18n
trying to figure it out from the API docs, w/o success
that’s just sad
Piotr Solnica
@solnic
def initialize
  @t = I18n.method(:t)
end

def lookup(predicate, arg)
  t.("errors.#{predicate}")
end
they see me callin, they hatin
Andy Holland
@AMHOL
:joy:
Piotr Solnica
@solnic
ok, I got it working, the same functionality is covered as with the built-in YAML messages
I need to…dry it up
there’s a bit of common, abstract functionality there
one interesting thing is that it is possible to provide error compiler that will convert our error representation to an AM-compatible structure so that in theory existing AM-based error message translations will work with it
ain’t gonna do it, just saying it’s possible ;)
Andy Holland
@AMHOL
:laughing:
Piotr Solnica
@solnic
Calculating -------------------------------------
ActiveModel::Validations
                       143.000  i/100ms
      dry-validation   927.000  i/100ms
-------------------------------------------------
ActiveModel::Validations
                          1.495k (± 7.3%) i/s -      7.579k
      dry-validation      9.429k (± 1.6%) i/s -     47.277k

Comparison:
      dry-validation:     9428.8 i/s
ActiveModel::Validations:     1494.6 i/s - 6.31x slower
this is AM+I18n-coercions vs dry-validation+I18n+coercions
Andy Holland
@AMHOL
:clap:
@solnic out of interest, how come you did class Messages::I18n rather than the usual nesting?
Piotr Solnica
@solnic
I really don’t know
I guess I’m inspired by current polish gov, so from now on “it’s just how it’s gonna be, because"
Andy Holland
@AMHOL
lol
Piotr Solnica
@solnic
the people want it, don’t you know
seriously though, just trying to avoid nesting
but it comes with the cost of having to require things in diff order
Andy Holland
@AMHOL
Yeah, I guess the loading errors come sparsely without Rails
Andy Holland
@AMHOL
@solnic 100 stars for dry-validation :D
Piotr Solnica
@solnic
I know, I wrote a script that notifies me via sms whenever it’s starred #noididnt
Andy Holland
@AMHOL
:joy:
I would've believed that you know
Too gullible
Luca Guidi
@jodosha
:100: :star2: :confetti_ball:
Piotr Solnica
@solnic
@jodosha :dancers:
Piotr Solnica
@solnic
@AMHOL thoughts on how to tackle complex error messages when you need more data than just input for a rule?
Andy Holland
@AMHOL
Not sure I understand fully, do you have an example?
Piotr Solnica
@solnic
ie you want to generate a message and provide a list of possible values that are dynamic, so you can’t hardcode it in the schema
basically every use case where a message needs data that come from some external source
Andy Holland
@AMHOL
I don't think we should do that
Piotr Solnica
@solnic
but it’s needed :)
Andy Holland
@AMHOL
lol
Piotr Solnica
@solnic
I told you I have all kinds of validation use cases :)