0
@@ -228,6 +228,7 @@ module ActiveRecord
0
def validates_confirmation_of(*attr_names)
0
configuration = { :message => ActiveRecord::Errors.default_error_messages[:confirmation], :on => :save }
0
configuration.update(attr_names.pop) if attr_names.last.is_a?(Hash)
0
+ configuration[:message].gsub!(/\"/, '\\\\\"')
0
for attr_name in attr_names
0
attr_accessor "#{attr_name}_confirmation"
0
@@ -253,10 +254,11 @@ module ActiveRecord
0
def validates_acceptance_of(*attr_names)
0
configuration = { :message => ActiveRecord::Errors.default_error_messages[:accepted], :on => :save }
0
configuration.update(attr_names.pop) if attr_names.last.is_a?(Hash)
0
+ configuration[:message].gsub!(/\"/, '\\\\\"')
0
for attr_name in attr_names
0
attr_accessor(attr_name)
0
- class_eval(%(#{validation_method(configuration[:on])} %{errors.add('#{attr_name}',
'#{configuration[:message]}') unless #{attr_name}.nil? or #{attr_name} == "1"}))
0
+ class_eval(%(#{validation_method(configuration[:on])} %{errors.add('#{attr_name}',
"#{configuration[:message]}") unless #{attr_name}.nil? or #{attr_name} == "1"}))
0
@@ -268,6 +270,7 @@ module ActiveRecord
0
def validates_presence_of(*attr_names)
0
configuration = { :message => ActiveRecord::Errors.default_error_messages[:empty], :on => :save }
0
configuration.update(attr_names.pop) if attr_names.last.is_a?(Hash)
0
+ configuration[:message].gsub!(/\"/, '\\\\\"')
0
for attr_name in attr_names
0
class_eval(%(#{validation_method(configuration[:on])} %{errors.add_on_empty('#{attr_name}', "#{configuration[:message]}")}))
0
@@ -411,12 +414,13 @@ module ActiveRecord
0
def validates_uniqueness_of(*attr_names)
0
configuration = { :message => ActiveRecord::Errors.default_error_messages[:taken] }
0
configuration.update(attr_names.pop) if attr_names.last.is_a?(Hash)
0
+ configuration[:message].gsub!(/\"/, '\\\\\"')
0
for attr_name in attr_names
0
if scope = configuration[:scope]
0
- class_eval(%(validate %{errors.add('#{attr_name}',
'#{configuration[:message]}') if self.class.find_first(new_record? ? ['#{attr_name} = ? AND #{scope} = ?', #{attr_name}, #{scope}] : ["#{attr_name} = ? AND \\\#{self.class.primary_key} <> ? AND #{scope} = ?", #{attr_name}, id, #{scope}])}))
0
+ class_eval(%(validate %{errors.add('#{attr_name}',
"#{configuration[:message]}") if self.class.find_first(new_record? ? ['#{attr_name} = ? AND #{scope} = ?', #{attr_name}, #{scope}] : ["#{attr_name} = ? AND \\\#{self.class.primary_key} <> ? AND #{scope} = ?", #{attr_name}, id, #{scope}])}))
0
- class_eval(%(validate %{errors.add('#{attr_name}',
'#{configuration[:message]}') if self.class.find_first(new_record? ? ['#{attr_name} = ?', #{attr_name}] : ["#{attr_name} = ? AND \\\#{self.class.primary_key} <> ?", #{attr_name}, id])}))
0
+ class_eval(%(validate %{errors.add('#{attr_name}',
"#{configuration[:message]}") if self.class.find_first(new_record? ? ['#{attr_name} = ?', #{attr_name}] : ["#{attr_name} = ? AND \\\#{self.class.primary_key} <> ?", #{attr_name}, id])}))
0
@@ -437,6 +441,7 @@ module ActiveRecord
0
def validates_format_of(*attr_names)
0
configuration = { :message => ActiveRecord::Errors.default_error_messages[:invalid], :on => :save, :with => nil }
0
configuration.update(attr_names.pop) if attr_names.last.is_a?(Hash)
0
+ configuration[:message].gsub!(/\"/, '\\\\\"')
0
raise(ArgumentError, "A regular expression must be supplied as the :with option of the configuration hash") unless configuration[:with].is_a?(Regexp)
0
@@ -459,6 +464,8 @@ module ActiveRecord
0
def validates_inclusion_of(*attr_names)
0
configuration = { :message => ActiveRecord::Errors.default_error_messages[:inclusion], :on => :save }
0
configuration.update(attr_names.pop) if attr_names.last.is_a?(Hash)
0
+ configuration[:message].gsub!(/\"/, '\\\\\"')
0
enum = configuration[:in] || configuration[:within]
0
allow_nil = configuration[:allow_nil]
0
@@ -497,6 +504,7 @@ module ActiveRecord
0
def validates_associated(*attr_names)
0
configuration = { :message => ActiveRecord::Errors.default_error_messages[:invalid], :on => :save }
0
configuration.update(attr_names.pop) if attr_names.last.is_a?(Hash)
0
+ configuration[:message].gsub!(/\"/, '\\\\\"')
0
for attr_name in attr_names
0
class_eval(%(#{validation_method(configuration[:on])} %{
Comments
No one has commented yet.