This project is archived and is in readonly mode.

#319 ✓duplicate
John Hume

Validation message formatting across the board

Reported by John Hume | June 3rd, 2008 @ 05:19 PM

This is a follow-up from #273.

This patch adds the same feature to the other validations where it made sense. (I didn't include validates_confirmation_of since that's for values you shouldn't be displaying (at least in any non-obnoxious usage).)

Also includes new/modified examples in the documentation.

Comments and changes to this ticket

  • Michael Koziarski

    Michael Koziarski June 3rd, 2008 @ 11:44 PM

    • Assigned user set to “Michael Koziarski”
  • Michael Koziarski

    Michael Koziarski August 31st, 2008 @ 06:40 PM

    • Tag set to activerecord, enhancement, patch

    Sorry it took so long for me to get back to this, but the patch nolonger applies cleanly.

    If you rebase it I'll be happy to apply this.

  • John Hume
  • John Hume

    John Hume September 3rd, 2008 @ 05:51 AM

    After a look at the conflict, I think this patch is now moot. It appears the I18n effort has resulted in {{value}} always being available for interpolation in error messages.

    It took me a while to figure out how the old-style substitution is still supported. I finally found this hack in simple.rb:

    
    string = string.gsub(/%d/, '{{count}}').gsub(/%s/, '{{value}}')
    

    If I'm missing anything let me know. Otherwise I guess this ticket should be closed. -hume.

  • Pratik

    Pratik December 20th, 2008 @ 07:18 PM

    • State changed from “new” to “duplicate”
  • Alex

    Alex February 8th, 2009 @ 02:11 PM

    This raises two issues:

    a: more than one %s causes problem thru interpolation key interambiguity (gsub results in more than one {{value}}s) b: {{value}} in beginning does not work

    alex

  • Alex

    Alex February 8th, 2009 @ 04:49 PM

    b works by quoting the translation

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Attachments

Pages