0
@@ -281,23 +281,7 @@ module ActiveRecord
0
base.send :include, ActiveSupport::Callbacks
0
- VALIDATIONS.each do |validation_method|
0
- base.class_eval <<-"end_eval"
0
- def self.#{validation_method}(*methods, &block)
0
- self.#{validation_method}_callback_chain | CallbackChain.build(:#{validation_method}, *methods, &block)
0
- def self.#{validation_method}_callback_chain
0
- if chain = read_inheritable_attribute(:#{validation_method})
0
- write_inheritable_attribute(:#{validation_method}, CallbackChain.new)
0
- return #{validation_method}_callback_chain
0
+ base.define_callbacks *VALIDATIONS
0
# All of the following validations are defined in the class scope of the model that you're interested in validating.
0
@@ -403,7 +387,7 @@ module ActiveRecord
0
# method, proc or string should return or evaluate to a true or false value.
0
# * <tt>unless</tt> - Specifies a method, proc or string to call to determine if the validation should
0
# not occur (e.g. :unless => :skip_validation, or :unless => Proc.new { |user| user.signup_step <= 2 }). The
0
- # method, proc or string should return or evaluate to a true or false value.
0
+ # method, proc or string should return or evaluate to a true or false value.
0
def validates_confirmation_of(*attr_names)
0
configuration = { :message => ActiveRecord::Errors.default_error_messages[:confirmation], :on => :save }
0
configuration.update(attr_names.extract_options!)
0
@@ -437,7 +421,7 @@ module ActiveRecord
0
# method, proc or string should return or evaluate to a true or false value.
0
# * <tt>unless</tt> - Specifies a method, proc or string to call to determine if the validation should
0
# not occur (e.g. :unless => :skip_validation, or :unless => Proc.new { |user| user.signup_step <= 2 }). The
0
- # method, proc or string should return or evaluate to a true or false value.
0
+ # method, proc or string should return or evaluate to a true or false value.
0
def validates_acceptance_of(*attr_names)
0
configuration = { :message => ActiveRecord::Errors.default_error_messages[:accepted], :on => :save, :allow_nil => true, :accept => "1" }
0
configuration.update(attr_names.extract_options!)
0
@@ -519,7 +503,7 @@ module ActiveRecord
0
# method, proc or string should return or evaluate to a true or false value.
0
# * <tt>unless</tt> - Specifies a method, proc or string to call to determine if the validation should
0
# not occur (e.g. :unless => :skip_validation, or :unless => Proc.new { |user| user.signup_step <= 2 }). The
0
- # method, proc or string should return or evaluate to a true or false value.
0
+ # method, proc or string should return or evaluate to a true or false value.
0
def validates_length_of(*attrs)
0
# Merge given options with defaults.
0
@@ -596,7 +580,7 @@ module ActiveRecord
0
# attribute (that maps to a column). When the record is updated, the same check is made but disregarding the record itself.
0
# Because this check is performed outside the database there is still a chance that duplicate values
0
- # will be inserted in two parallel transactions. To guarantee against this you should create a
0
+ # will be inserted in two parallel transactions. To guarantee against this you should create a
0
# unique index on the field. See +add_index+ for more information.
0
# Configuration options:
Comments
No one has commented yet.