Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 00:58
    dteoh starred dry-rb/dry-types
  • Nov 17 21:02
    flash-gordon commented #374
  • Nov 17 21:01

    flash-gordon on master

    Update custom_ci.yml Merge pull request #374 from sk… (compare)

  • Nov 17 21:01
    flash-gordon closed #374
  • Nov 17 20:59
    skryukov opened #374
  • Nov 17 16:42

    flash-gordon on use-immutable-equalizer

    (compare)

  • Nov 17 16:42

    flash-gordon on master

    Use immutable equalizer for all… Merge pull request #373 from dr… (compare)

  • Nov 17 16:42
    flash-gordon closed #373
  • Nov 17 16:38
    flash-gordon opened #373
  • Nov 17 16:38

    flash-gordon on use-immutable-equalizer

    Use immutable equalizer for all… (compare)

  • Nov 17 16:34

    flash-gordon on no-rewrap-for-structs

    (compare)

  • Nov 17 16:34

    flash-gordon on master

    Don't build constructors when c… Merge pull request #371 from dr… (compare)

  • Nov 17 16:34
    flash-gordon closed #371
  • Nov 16 11:28
    marekciupak starred dry-rb/dry-monads
  • Nov 16 07:48
    luizfonseca starred dry-rb/dry-view
  • Nov 15 18:52
    waiting-for-dev commented #114
  • Nov 15 16:06
    businessBoris starred dry-rb/dry-system
  • Nov 15 15:16
    businessBoris starred dry-rb/dry-monads
  • Nov 15 08:22
    gruz0 starred dry-rb/dry-types
  • Nov 14 12:03
    pedrofurtado starred dry-rb/dry-matcher
Andy Holland
@AMHOL
I think it makes sense to make it extendible, if there's this use case there will be more
Nikita Shilnikov
@flash-gordon
guys, I raised an issue about replacing kleisli with something else. Any thoughts are very welcome dry-rb/dry-types#80 :)
Tim Riley
@timriley
@nepalez yeah, I think explicit support of AR is outside of dry-rb's mission. So having another gem to add these methods in would seem better to me.
@flash-gordon I feel generally in favor of this. Will comment on the GH issue later on :)
panigrah
@panigrah
@fran-worley i get the same error NoMethodError (undefined methodjoin' for 1..5:Range):`
Fran Worley
@fran-worley
@panigrah I'll have a look tomorrow. I know it works with my updated predicates branch but it's not ready for release yet.
panigrah
@panigrah
thanks Fran! when do you all plan to release the new schema docs?
panigrah
@panigrah

is there a change to the rules api in master? I have this bit failing;

    rule(destiny: [:red, :blue]) do |red, blue|
        red.filled? | blue.filled?
    end

with:
schema/value.rb:82:inrule': undefined method with' for true:TrueClass (NoMethodError)

nilobject
@nil0bject

trying to use coercion. Why doesn’t

Types::Form::Bool['False']
=> "False"

return false?

:(
[17] pry(main)> LocalSearch::Types::Form::Bool['1']
=> true
[18] pry(main)> LocalSearch::Types::Form::Bool['0']
=> false
[19] pry(main)> LocalSearch::Types::Form::Bool['false']
=> false
[20] pry(main)> LocalSearch::Types::Form::Bool['False']
=> "False"
Fran Worley
@fran-worley
@panigrah can you send the rest of your schema?
Tim Cooper
@coop
@nil0bject these are the supported form boolean coercions - https://github.com/dry-rb/dry-types/blob/master/lib/dry/types/coercions/form.rb#L8-L10
panigrah
@panigrah
whats the preferred location to store dry-v error file for custom messages in a rails app?
dan-klasson
@dan-klasson
@panigrah probably config/locales/en/errors.yml
dan-klasson
@dan-klasson
@nil0bject why would it? this is not python ;)
Christopher Dennl-Ortega Arrieta
@cdennl
@panigrah name of the file doesn't matter as long as this file contains an 'errors' key
below the language
panigrah
@panigrah
@cdennl i was looking for the correct location to place this file in. @dan-klasson - dry-v is searching for custom error messages (for the unique?) test. Am adding it to config/locales.
Fran Worley
@fran-worley
You have to specify where your file is in the config
panigrah
@panigrah
thanks @fran-worley was looking to see where in the dir structure I should have this. will follow dan's suggestion. Is there a way to override the global location? i don't want to add this to every configure block in every schema.
Fran Worley
@fran-worley
@panigrah I guess you could create a base schema class with your error config and inherit from that. I am pretty sure there is no global method currently
Tim Riley
@timriley
I bet “no global method” would be by design :)
Fran Worley
@fran-worley
@timriley I'm sure but it would be lovely not to be able to declare it once... I include the message config line in every schema (and I have quite a number...)
And they reference the exact same files.
Tim Riley
@timriley
Couldn’t you do what you suggest above and create a base schema class?
panigrah
@panigrah
thank you @fran-worley
Fran Worley
@fran-worley
Yeah I'm sure provided you can extend the base config block
Plus I use Reform which defines its own schema class...
panigrah
@panigrah
@fran-worley i am using this with reform, which just passes the block over to dry-v - would i need to monkey patch it to override the base schema class?
Tim Riley
@timriley
@fran-worley yep, looking over the code, I think it would be no problem to have a base schema class with a configure do; config.messages = “…”; end and then other schemas inheriting from that base and providing their own configure blocks too.
Fran Worley
@fran-worley
@timriley good to know
@panigrah not sure about Reform 2.2 but on 2.1 you would. It's one of my dislikes.
Andy Holland
@AMHOL
@panigrah @fran-worley it's just using dry-configurable so global configuration would be:
Dry::Validation::Schema.configure do |config|
  config.messages_file = '/path/to/my/errors.yml'
end
dan-klasson
@dan-klasson
@AMHOL yeah, that looks perfect. @panigrah stick that in config/initializers/trailblazer.rb
Fran Worley
@fran-worley
@AMHOL that is really useful. That should definitely go in the docs.
Andy Holland
@AMHOL
:+1:
Simon Schmid
@sled
Andy Holland
@AMHOL
@sled that's for configuring a single schema
Simon Schmid
@sled
ah you can configure it globally
:D
that's cool for an initializer
panigrah
@panigrah

I have a custom validation "unique?" for a rule called "name" - my error.yaml file is below

en:
  errors:
     unique?: "Value must be unique"

I continue to get

`Dry::Validation::MissingMessageError: message for unique?`
the error file is setup per AMHOL's posting above
Piotr Solnica
@solnic
What if you put it under name key?
Andy Holland
@AMHOL
@panigrah I take it you restarted/reloaded after adding the initializer ?
Fran Worley
@fran-worley
This message was deleted
Fran Worley
@fran-worley

@panigrah if you're writing an error for a rule you need your messages to look something like this:

en:
  errors:
    #regular error messages

  rules:
    name:
      unique?: "the name name must be unique"

Look at the end of the example on http://dry-rb.org/gems/dry-validation/error-messages/

panigrah
@panigrah
@fran-worley and @solnic - no luck. Will try to debug in the morning - am using master