Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 08:53
    flash-gordon labeled #376
  • 08:44
    solnic commented #376
  • Dec 12 21:34
    flash-gordon commented #376
  • Dec 12 21:34
    flash-gordon labeled #376
  • Dec 12 21:34
    flash-gordon opened #376
  • Dec 12 19:32
    RyanLafferty starred dry-rb/dry-types
  • Dec 12 05:53
    technofreak starred dry-rb/dry-monads
  • Dec 12 00:14
    thekuwayama starred dry-rb/dry-monads
  • Dec 11 09:29
    blasterun starred dry-rb/dry-monads
  • Dec 11 08:34
    flash-gordon closed #115
  • Dec 11 08:34
    flash-gordon commented #115
  • Dec 11 08:31

    flash-gordon on v1.3.3

    (compare)

  • Dec 11 08:30

    flash-gordon on master

    Bump version to 1.3.3 (compare)

  • Dec 11 08:30

    flash-gordon on master

    Update CHANGELOG (compare)

  • Dec 10 23:46
    johnmaxwell commented #116
  • Dec 10 21:54

    flash-gordon on master

    Halt with mutable backtrace Ex… Merge pull request #116 from jo… (compare)

  • Dec 10 21:54
    flash-gordon closed #116
  • Dec 10 21:54
    flash-gordon commented #116
  • Dec 10 21:49
    johnmaxwell commented #116
  • Dec 10 21:47
    johnmaxwell commented #116
Sascha Korth
@skorth
If i don't cleanup the resulting hash beforehand.
Nikita Shilnikov
@flash-gordon
@skorth wrong :) When you're using AR you're don't inlining anything by hand into a query, so it's safe because AR escapes values before using them in SQL (or uses bind variables the DB supports them, but that's another story). What I mean basically is that you mustn't write something like User.where("name = '#{ name }'") where name is a string obtained from a request/form. Instead you always do it like this User.where('name = ?', name)
Sascha Korth
@skorth
@flash-gordon Ahhh your right, its AR that escapes, and not strong_params. My fault! Thanks for that.
Daniel Gollahon
@dgollahon
@cdennl: thanks. at first I was thinking something like that wouldn't work, but it turns out I made i provided symbols to the rule when i needed to provide an array of strings (since my input keys are strings). after fixing that, your strategy works. :)
Christopher Dennl-Ortega Arrieta
@cdennl
@dgollahon fine :)
Soumya Ray
@soumyaray
Greetings, I just installed dry-validation (0.10.3). As soon as i require 'dry-validation' in my code or in pry, I get this warning:
/Users/soumyaray/.rvm/gems/ruby-2.3.1/gems/dry-validation-0.10.3/lib/dry/validation/message_compiler.rb:13: warning: already initialized constant Dry::Validation::MessageCompiler::EMPTY_OPTS
/Users/soumyaray/.rvm/gems/ruby-2.3.1/gems/dry-core-0.2.1/lib/dry/core/constants.rb:52: warning: previous definition of EMPTY_OPTS was here
Tim Riley
@timriley
@soumyaray that's a known issue, and nothing to worry about. We'll be hopefully fixing soon.
Soumya Ray
@soumyaray
@timriley thanks! i started an issue on the repo because i didn't see it listed. i'll close it then?
Tim Riley
@timriley
I dunno, feel free to leave it, we can always close it later.
Jérémie Horhant
@Titinux
Hi. I'm starting to make some experimentation with dry-web-roda and I have a little question. How can I pass arguments to the view renderer ? (like default_encoding: 'utf-8' or escape_html: false) I need the last one because I'm using hamlit which by default escapes html and that break the view rendering inside layout.
Lucas Hosseini
@beauby
@soumyaray I’m getting the same – did you open an issue already?
Soumya Ray
@soumyaray
@beauby yes, they're on it :)
Lucas Hosseini
@beauby
:+1:
alexeymoshkin
@alexeymoshkin

Hi there! How can I change property value, when form.validate depending on value of other property in this form
For example:

property :amount
property :type

if type == 'negative'
  amount = 0 - amount
end

Any solution?

Christopher Dennl-Ortega Arrieta
@cdennl
@alexeymoshkin high level rules, look in the docs
alexeymoshkin
@alexeymoshkin
@cdennl thanks, I will try
Martín Fernández
@bilby91
This message was deleted
Martín Fernández
@bilby91
It it possible to use AutoInject in a rails concern ?
Tim Riley
@timriley
You really want to include it in a class, not in another module.
Ernest Bursa
@swistaczek
Hey guys, did some one tried integrating dry-system with existing rails app?
I would be happy if anyone could share an example, this will be great for boosting my lunch time to dry-rb concept :)
Tim Riley
@timriley
I'm not sure if anyone has an app they can share for this, @swistaczek, but solnic did write a dry-system-rails gem to provide s railtie, so it should be possible.
Martín Fernández
@bilby91
Hey, I’m willing to help on the dry-system for rails too!
George Millo
@georgemillo
Can someone explain to me the difference between hints, errors, and messages in dry-v?
looks like messages = hints + errors, amirite?
but what's the difference between hints and errors?
Christopher Dennl-Ortega Arrieta
@cdennl
@georgemillo one is all messages that can happen, and the other is only messages for errors that actually happened
Martín Fernández
@bilby91
Should I expect the correct coercion for this validations ? The input can be a string like “120” or “1.2"
Dry::Validation.Form do
      optional(:width).maybe { float? | int? }
      optional(:height).maybe { float? | int? }
end
George Millo
@georgemillo
@cdennl I thought so, but there seem to be some inconsistencies there
I'll move it to the discussion forums
Sergey Kukunin
@Kukunin
is there any reason behind the prevention to overwrite attributes in inherited dry-struct ?
currently it has check, that attribute is already defined, and crashes
Nikita Shilnikov
@flash-gordon
@Kukunin I doubt there is any strong reason for this, pls open an issue, will see what Piotr and John will say. I'd personally :+1: for removing this restriction
Tim Riley
@timriley
Yeah, it'd made sense to me to allow attributes to be redefined.
Alexey Zapparov
@ixti
Hi all. Is there a way to define custom coercion type for schema?
I have an endpoint that accepts list of ids separated with comma, so i want to do something like:
schema = Dry::Validation.Form do
  required(:ids) { comma_separated_list? }
end

schema.call({ "ids" => "1,2,3" })["ids"] # => ["1", "2", "3"]
Tim Riley
@timriley
@ixti Sounds like something that type specs (http://dry-rb.org/gems/dry-validation/type-specs/) and a custom type would help you achieve
e.g. something like required(:ids, Types::MyCommaSeparatedList).filled(:array?)
where that MyCommaSeparatedList type would accept string input and coerce it into an array
Alexey Zapparov
@ixti
@timriley mm, yeah. that will definitely work for me indeed. Thanks!
Alexey Zapparov
@ixti
Was it considered change API a bit? like instead of Dry::Validation.Form it would be better to write Dry::Validation::Form.describe imho :D
I'm OK with current API. It just looks a bit awkward to me :D
As awkward as when I see someone uses :: to call method
Christian
@bakku
In dry-validation is there a difference between required(:name) and required(:name).filled?
Andy Holland
@AMHOL
required(:name) means the hash key is required, .filled? means the value must be non-blank
Ralf Schmitz Bongiolo
@mrbongiolo
Is there a way to coerce array values with dry-validation?
Tim Riley
@timriley
@mrbongiolo what sort of thing would you like to achieve?
Ralf Schmitz Bongiolo
@mrbongiolo
@timriley Actually I have a form that sends IDs, but as string, I would like to coerce them to Integer, something like:
optional(:my_ids, [:nil, :array]).each([:nil, :int], :int?)
Tim Riley
@timriley
OK cool. And is this a Dry::Validation.Form schema?
Fran Worley
@fran-worley
@mrbongiolo I use Types::Form::Array.member(Types::Form::Int) works perfectly in my Reform form to do exactly as you describe