Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 8825

Show
Ignore:
Timestamp:
02/09/08 08:24:35 (7 months ago)
Author:
nzkoz
Message:

Remove misleading / incorrect warning from validation documentation. Closes #8241 [quixoten, pedz, tom]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/activerecord/lib/active_record/validations.rb

    r8802 r8825  
    478478      #   method, proc or string should return or evaluate to a true or false value. 
    479479      # 
    480       # === Warning 
    481       # Validate the presence of the foreign key, not the instance variable itself. 
    482       # Do this: 
    483       #  validates_presence_of :invoice_id 
    484       # 
    485       # Not this: 
    486       #  validates_presence_of :invoice 
    487       # 
    488       # If you validate the presence of the associated object, you will get 
    489       # failures on saves when both the parent object and the child object are 
    490       # new. 
    491480      def validates_presence_of(*attr_names) 
    492481        configuration = { :message => ActiveRecord::Errors.default_error_messages[:blank], :on => :save }