Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Validation message formatting across the board

#319

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.

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

State: duplicate
Milestone: none
Assigned to: Michael Koziarski Michael Koziarski
Importance: none

Activity

  1. Michael Koziarski
    Michael Koziarski
    • Assigned user set to Michael Koziarski

    June 3rd, 2008 @ 11:44 PM

  2. Michael Koziarski
    Michael Koziarski
    • 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.

    August 31st, 2008 @ 06:40 PM

  3. John Hume
  4. John Hume
    John Hume

    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.

    September 3rd, 2008 @ 05:51 AM

  5. Pratik
    Pratik
    • State changed from new to duplicate

    December 20th, 2008 @ 07:18 PM

  6. Alex
    Alex

    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

    February 8th, 2009 @ 02:11 PM

  7. Alex
    Alex

    b works by quoting the translation

    February 8th, 2009 @ 04:49 PM