Ticket #3228: allow_nil.diff
| File allow_nil.diff, 1.1 kB (added by shawn@garbett.org, 3 years ago) |
|---|
-
activerecord/lib/active_record/validations.rb
old new 226 226 :on => :save, 227 227 :allow_nil => false, 228 228 :message => nil 229 } .freeze229 } 230 230 231 231 ALL_RANGE_OPTIONS = [ :is, :within, :in, :minimum, :maximum ].freeze 232 232 … … 351 351 # occur (e.g. :if => :allow_validation, or :if => Proc.new { |user| user.signup_step > 2 }). The 352 352 # method, proc or string should return or evaluate to a true or false value. 353 353 def validates_acceptance_of(*attr_names) 354 configuration = { :message => ActiveRecord::Errors.default_error_messages[:accepted], :on => :save, :allow_nil => true, :accept => "1" }354 configuration = { :message => ActiveRecord::Errors.default_error_messages[:accepted], :on => :save, :allow_nil => true, :accept => "1", :allow_nil => false } 355 355 configuration.update(attr_names.pop) if attr_names.last.is_a?(Hash) 356 356 357 357 attr_accessor *attr_names