Patches: Browse | Submit New | Admin

[#2347] Patch to add localization support for model validation

Date:
2005-08-31 03:57
Priority:
3
Submitted By:
David Barri (golly)
Assigned To:
Joe Hosteny (jhosteny)
Category:
None
State:
Open
Summary:
Patch to add localization support for model validation

Detailed description
In a model class, the following will not work:
  validates_presence_of :first_name, :message => l(:err_no_first_name)
  validates_presence_of :last_name, :message => l(:err_no_last_name)

A self.l() function must also exist in the localization module which allows the following to work:
  validates_presence_of :first_name, :message => Localization::l(:err_no_first_name)
  validates_presence_of :last_name, :message => Localization::l(:err_no_last_name)

But the above is long and horrible so the patch allows the for the following:
  validates_presence_of :first_name, :lmsg => :err_no_first_name
  validates_presence_of :last_name, :lmsg => :err_no_last_name

Add A Comment: Notepad

Please login


Followup

Message
Date: 2005-09-01 01:57
Sender: David Barri

Oops, forgot a line. Here's a new patch.

Attached Files:

Name Description Download
localization_patch.diff Patch Download
localization_patch_050901.diff Revised patch Download

Changes:

Field Old Value Date By
assigned_tonone2005-09-01 01:58golly
File Added276: localization_patch_050901.diff2005-09-01 01:57golly
File Added271: localization_patch.diff2005-08-31 03:57golly