removed translation of error messages inside ActiveRecord module

git-svn-id: http://redmine.rubyforge.org/svn/trunk@222 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2007-02-03 12:42:06 +00:00
parent b5e80bf90f
commit 4a988b0f92
1 changed files with 23 additions and 23 deletions

View File

@ -130,29 +130,29 @@ module ActiveRecord #:nodoc:
include GLoc
end
class Errors
include GLoc
alias :add_without_gloc :add
# The GLoc version of this method provides two extra features
# * If <tt>msg</tt> is a string, it will be considered a GLoc string key.
# * If <tt>msg</tt> is an array, the first element will be considered
# the string and the remaining elements will be considered arguments for the
# string. Eg. <tt>['Hi %s.','John']</tt>
def add(attribute, msg= @@default_error_messages[:invalid])
if msg.is_a?(Array)
args= msg.clone
msg= args.shift
args= nil if args.empty?
end
msg= ltry(msg)
msg= msg % args unless args.nil?
add_without_gloc(attribute, msg)
end
# Inherits the current language from the base record.
def current_language
@base.current_language
end
end
# class Errors
# include GLoc
# alias :add_without_gloc :add
# # The GLoc version of this method provides two extra features
# # * If <tt>msg</tt> is a string, it will be considered a GLoc string key.
# # * If <tt>msg</tt> is an array, the first element will be considered
# # the string and the remaining elements will be considered arguments for the
# # string. Eg. <tt>['Hi %s.','John']</tt>
# def add(attribute, msg= @@default_error_messages[:invalid])
# if msg.is_a?(Array)
# args= msg.clone
# msg= args.shift
# args= nil if args.empty?
# end
# msg= ltry(msg)
# msg= msg % args unless args.nil?
# add_without_gloc(attribute, msg)
# end
# # Inherits the current language from the base record.
# def current_language
# @base.current_language
# end
# end
module Validations #:nodoc:
module ClassMethods