Remove DEFAULT_VALIDATION_OPTIONS from validations

This commit is contained in:
Pratik Naik 2009-03-21 01:14:58 +00:00
parent 22ad30ed60
commit 379e468034
2 changed files with 1 additions and 5 deletions

@ -9,8 +9,6 @@ def self.included(base) # :nodoc:
end
module ClassMethods
DEFAULT_VALIDATION_OPTIONS = { :on => :save, :allow_nil => false, :allow_blank => false, :message => nil }.freeze
# Adds a validation method or block to the class. This is useful when
# overriding the +validate+ instance method becomes too unwieldly and
# you're looking for more descriptive declaration of your validations.

@ -40,9 +40,7 @@ module ClassMethods
# Defaults to <tt>lambda{ |value| value.split(//) }</tt> which counts individual characters.
def validates_length_of(*attrs)
# Merge given options with defaults.
options = {
:tokenizer => lambda {|value| value.split(//)}
}.merge(DEFAULT_VALIDATION_OPTIONS)
options = { :tokenizer => lambda {|value| value.split(//)} }
options.update(attrs.extract_options!.symbolize_keys)
# Ensure that one and only one range option is specified.