Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 13:31
    timriley synchronize #181
  • 13:31

    timriley on explicit-two-way-component-dir-namespaces

    Support configuring namespaces … (compare)

  • 13:01
    timriley synchronize #181
  • 13:01

    timriley on explicit-two-way-component-dir-namespaces

    Make it possible to resolve top… (compare)

  • 12:56
    timriley synchronize #181
  • 12:56

    timriley on explicit-two-way-component-dir-namespaces

    Remove unused error Tweak docs and param names in C… Make it possible to resolve top… (compare)

  • 05:23
    nkelton starred dry-rb/dry-monads
  • Sep 22 15:36
  • Sep 22 12:33
    timriley synchronize #181
  • Sep 22 12:33

    timriley on explicit-two-way-component-dir-namespaces

    Flesh out Identifier tests (and… (compare)

  • Sep 22 12:30
    timriley synchronize #181
  • Sep 22 12:30

    timriley on explicit-two-way-component-dir-namespaces

    Change Identifier attr name to … Flesh out Identifier tests (and… (compare)

  • Sep 22 11:21
    skryukov edited #92
  • Sep 22 11:06
    skryukov opened #92
  • Sep 22 10:52
  • Sep 22 05:36
    timriley synchronize #181
  • Sep 22 05:36

    timriley on explicit-two-way-component-dir-namespaces

    Introduce NullComponent and cle… Fix rubocop issues (compare)

  • Sep 22 05:22
    timriley synchronize #181
  • Sep 22 05:22

    timriley on explicit-two-way-component-dir-namespaces

    Fix rubocop issues (compare)

  • Sep 22 05:15
    timriley synchronize #181
dan-klasson
@dan-klasson
but intend to in the near future when TRB is ready
have to refactor this massive rails app. was thinking i'll start with cells first
Simon Schmid
@sled
I also have to refactor a quite messy rails app, but decided to start from scratch
dry seems like a good choice, alternative is to roll my own
Christopher Dennl-Ortega Arrieta
@cdennl
dry-v 0.7 works with reform 2.2 @fran-worley
Fran Worley
@fran-worley
@cdennl yeah I know thanks :)
Soumya Ray
@soumyaray
Hi everyone, is http://dry-rb.org/gems/dry-validation/error-messages/ still up-to-date? because calling Dry::Validation::Messages.load says its a private method.
Soumya Ray
@soumyaray

I'm seeing people creating custom errors and calling messages on their schemas but not sure how thats working. Here's the code I'm playing with:

FileSchema = Dry::Validation.Schema do
  key(:filename).required(:no_path?)

  key(:document).required(:str?)

  configure do
    config.messages_file = 'custom_errors.yml'

    def no_path?(value)
      !(value =~ %r{/})
    end
  end
end

msgs = FileSchema.call(
  filename: 'path/file.txt',
  document: '---'
).messages

that last messages call creates a Dry::Validation::MissingMessageError: message for no_path? was not found, even though I can see my custom error message in the definition of FileSchema

Christopher Dennl-Ortega Arrieta
@cdennl
how does custom_errors.yml look like?
@soumyaray
Soumya Ray
@soumyaray
@cdennl: oops -- you made me check, and sure enough i forgot to put an errors: key in it :( it works now! :) many thanks
Christopher Dennl-Ortega Arrieta
@cdennl
one point for my crystal ball :D you're welcome
Soumya Ray
@soumyaray
last question before bed (far east over here): is there any way to contribute to the documentation like http://dry-rb.org/gems/dry-validation/error-messages/ and other help pages for dry-rb? they seem out-of-date or incomplete at places.
Christopher Dennl-Ortega Arrieta
@cdennl
depends, the docs are ok if you use 0.7
and afaik they're working on 0.8
Fran Worley
@fran-worley
@soumyaray there is a GitHub repo for the docs. Feel free to make a pull request. https://github.com/dry-rb/dry-rb.org
Soumya Ray
@soumyaray
@fran-worley: thanks!

@cdennl: in the link above, it suggests that after defining custom error messages in a yaml file, to lookup error mesages using:

messages = Dry::Validation::Messages.load('/path/to/our/errors.yml')

and looking up the resulting messages structure. but that Messages.load method is now private. I might be misreading/misinterpreting it of course.

Christopher Dennl-Ortega Arrieta
@cdennl
no it doesnt suggest it
it only demonstrates what happens internally
@soumyaray
Soumya Ray
@soumyaray
@cdennl: i see -- i misinterpreted it as i suspected.
Christopher Dennl-Ortega Arrieta
@cdennl
@soumyaray No problem, I had a rough start with dry-v and trb by myself as well :) but I now I try to help ppl getting it running as well. However, I am only a gem consumer, I am not involved in development of the gems
Soumya Ray
@soumyaray
@cdennl: then i'm doubly thankful for all your help! i really see the value of dry-rb and rom-rb, but their predecessors (virtus, sequel, etc.) have spoilt me on being braindead simple to start up on. i'm paying the piper for that now. :)
David Strauß
@stravid
I just stumbled upon dry-container and I'm not sure in which scenarios such a pattern is best used. Can someone give me reading recommendations to dive into this topic?
Oskar Szrajer
@gotar
maybe source code of: https://github.com/solnic/rodakase-blog and dry-web
not sure there is any good article, tutorial
Tim Riley
@timriley
@stravid http://dry-rb.org/gems/dry-component/ also shows how you can use a container to manage an app’s dependencies.
I hope to write some articles/tutorials and share some OSS example apps, but it might be a month or two before they’re all out.
Tim Riley
@timriley
Yeah, dry-container is pretty great for flexible plugin registries and the like.
The container we use for step adapters in dry-transaction makes stuff like this possible: http://dry-rb.org/news/2016/04/07/dry-transaction-0-6-brings-powerful-new-support-for-custom-step-adapters/
(the part where you inherit from Dry::Transaction::StepAdapters to extend the default container with your own items)
Benjamin Klotz
@tak1n
@timriley we use it for different api error handlers -> register :facebook, FacebookErrorHandler.new etc etc and then depending on which platform u want to publish it resolves to the proper error handler to see what happened on error cases and with which errors we can deal in a somewhat meaningful way
Tim Riley
@timriley
Nice. This is a good pattern.
Benjamin Klotz
@tak1n
I really like it :D
Tim Riley
@timriley
In the past I’ve done silly things like constantizing strings to try and get class names.
Benjamin Klotz
@tak1n
yep
const_get inc
Tim Riley
@timriley
But that’s so fragile. And not flexible.
Registering things with an explicit name is much much better.
Benjamin Klotz
@tak1n
yep, with const_get its easy to get everything u could possible get as const, and you have to deal with that eg.: use const_get only on proper modules where its allowed etc
with this registering and resolving its pretty explicit and you don't forget that
David Strauß
@stravid
I see, I will have to do some reading and thinking to figure out how it fits into my understanding of app development. Thanks for the input @tak1n @timriley
Simon Schmid
@sled
also it's much easier to write stubs ;)
Tim Riley
@timriley
Published the next in my “convince everyone to Ruby the dry-rb way” series: http://icelab.com.au/articles/inactive-records-the-value-objects-your-app-deserves/
Tim Cooper
@coop
s/Upboat/Upvote/
I think I prefer upboat.
Tim Riley
@timriley
aww, where’s the fun in that? ;)