Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 09:55

    dry-bot on master

    [devtools] sync configs (compare)

  • 09:55

    dry-bot on master

    [devtools] sync configs (compare)

  • 09:55

    dry-bot on master

    [devtools] sync configs (compare)

  • 09:54

    dry-bot on master

    [devtools] sync configs (compare)

  • 09:54

    dry-bot on master

    [devtools] sync configs (compare)

  • 09:54

    dry-bot on master

    [devtools] sync configs (compare)

  • 09:54

    dry-bot on master

    [devtools] sync configs (compare)

  • 09:54

    dry-bot on master

    [devtools] sync configs (compare)

  • 09:54

    dry-bot on master

    [devtools] sync configs (compare)

  • 09:54

    dry-bot on master

    [devtools] sync configs (compare)

  • 09:52

    dry-bot on master

    [devtools] sync configs (compare)

  • 09:52

    dry-bot on master

    [devtools] sync configs (compare)

  • 09:52

    dry-bot on master

    [devtools] sync configs (compare)

  • 09:52

    dry-bot on master

    [devtools] sync configs (compare)

  • 09:52

    dry-bot on master

    [devtools] sync configs (compare)

  • 09:52

    dry-bot on master

    [devtools] sync configs (compare)

  • 09:50
    Travis dry-rb/dry-view (master) errored (695)
  • 09:47

    solnic on master

    Update sync_configs.yml (compare)

  • 09:47

    solnic on master

    Update sync_configs.yml (compare)

  • 09:46

    solnic on master

    Update sync_configs.yml (compare)

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
Piotr Solnica
@solnic
We've got specs which covers this type of usecases but not for i18n. Maybe sth there is happening. I'll investigate when I'm back home from holidays (tomorrow)
dan-klasson
@dan-klasson
@solnic ha. i knew you couldn't stay away ;)
Pablo Herrero
@pabloh
Hey anyone got any thoughts regarding: dry-rb/dry-constructor#5 ?
Piotr Solnica
@solnic
@dan-klasson i did until yesterday
dan-klasson
@dan-klasson
@solnic yeah that's a lot better than i anticipated :)
how was the vacation? all nice any sunny beaches?
Piotr Solnica
@solnic
Got sun burned. So yes. Sunny
Simon Schmid
@sled
they should build UV light into computer screens to prepare for holidays ;)
Piotr Solnica
@solnic
Who would have thought that sun at 3000 meters mountain can harm you when you don't use any sunblocker
Simon Schmid
@sled
never been skiing? :)
Piotr Solnica
@solnic
I've been skiing since I was 3yo. I'm just a moron every now and then and forget about basic stuff :)
dan-klasson
@dan-klasson
oh man growing up in Sweeeden. My class mates in public school could not believe that I actually went skiing in Austria given how brown my skin was. Not knowing anything about Austria, they thought it was more plausible that I was lying. Hilarious. Man I'm still pissed at my dad for letting me grow up with those rednecks.
Christopher Dennl-Ortega Arrieta
@cdennl
@panigrah if you're using rails and i18n, don't specify the path but use config.message = :i18n
this is my custom file:
```
en:
  errors:
    is_conversion_correct?:                 'is incorrectly converted from P to $'