update_attributes method when the Validations module is mixed
in, which is the default behavior of Active Record.
valid?()
valid? runs validate and validate_on_create or validate_on_update. It returns true if no
errors were detected and false if there were validation errors.
APPENDIX ?– ACTIVE RECORD METHODS IN DETAIL 254
Protected Instance Methods
validate()
This method is run for all saves (both create and update). Override this method in your class
to provide validations, and use errors.add(attribute, msg) to register validation errors.
ActiveRecord::Validations::ClassMethods contains several higher level validation helper
methods.
validate_on_create()
This method is run on a save action for an Active Record object when the object has not yet
been saved to the database. Override this method in your class to provide validations, and use
errors.add(attribute, msg) to register validation errors. ActiveRecord::Validations::
ClassMethods contains several higher level validation helper methods.
validate_on_update()
This method is run for all saves where the Active Record object already has been saved and
has a corresponding record in the database table.
Pages:
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556