aboutsummaryrefslogtreecommitdiffstats
path: root/railties/doc/guides/source
diff options
context:
space:
mode:
authorCassioMarques <cassiommc@gmail.com>2009-01-01 16:51:58 -0200
committerCassioMarques <cassiommc@gmail.com>2009-01-01 16:51:58 -0200
commit34a10b42421cd39520bff067ee9ed5fb83b75b15 (patch)
tree427a0dfe74081bf9b6b49a248d54e31d7a14d915 /railties/doc/guides/source
parentd5c72192224048b51097172423ab7357aa1a89e5 (diff)
downloadrails-34a10b42421cd39520bff067ee9ed5fb83b75b15.tar.gz
rails-34a10b42421cd39520bff067ee9ed5fb83b75b15.tar.bz2
rails-34a10b42421cd39520bff067ee9ed5fb83b75b15.zip
Removed stuff about overriding validate_on_create on the AR Validations and Callbacks Guide, added new section to the Authors page
Diffstat (limited to 'railties/doc/guides/source')
-rw-r--r--railties/doc/guides/source/activerecord_validations_callbacks.txt14
-rw-r--r--railties/doc/guides/source/authors.txt6
2 files changed, 7 insertions, 13 deletions
diff --git a/railties/doc/guides/source/activerecord_validations_callbacks.txt b/railties/doc/guides/source/activerecord_validations_callbacks.txt
index f57cee3c00..ff2acdf8d5 100644
--- a/railties/doc/guides/source/activerecord_validations_callbacks.txt
+++ b/railties/doc/guides/source/activerecord_validations_callbacks.txt
@@ -383,19 +383,7 @@ end
== Writing your own validation methods
-When the built-in validation helpers are not enough for your needs, you can write your own validation methods, by implementing one or more of the +validate+, +validate_on_create+ or +validate_on_update+ methods. As the names of the methods states, the right method to implement depends on when you want the validations to be ran. The meaning of valid is still the same: to make an object invalid you just need to add a message to it's +errors+ collection.
-
-[source, ruby]
-------------------------------------------------------------------
-class Invoice < ActiveRecord::Base
- def validate_on_create
- errors.add(:expiration_date, "can't be in the past") if
- !expiration_date.blank? and expiration_date < Date.today
- end
-end
-------------------------------------------------------------------
-
-If your validation rules are too complicated and you want to break them in small methods, you can implement all of them and call one of +validate+, +validate_on_create+ or +validate_on_update+ methods, passing it the symbols for the methods' names.
+When the built-in validation helpers are not enough for your needs, you can write your own validation methods. You can do that by implementing methods that verify the state of your models and add messages to their +errors+ collection when they are invalid. You must then register those methods by using one or more of the +validate+, +validate_on_create+ or +validate_on_update+ class methods, passing in the symbols for the validation methods' names. You can pass more than one symbol for each class method and the respective validations will be ran in the same order as they were registered.
[source, ruby]
------------------------------------------------------------------
diff --git a/railties/doc/guides/source/authors.txt b/railties/doc/guides/source/authors.txt
index 987238eb4c..aaa428fd79 100644
--- a/railties/doc/guides/source/authors.txt
+++ b/railties/doc/guides/source/authors.txt
@@ -43,3 +43,9 @@ and unobtrusive JavaScript. His home on the internet is his blog http://tore.dar
***********************************************************
Jeff Dean is a software engineer with http://pivotallabs.com/[Pivotal Labs].
***********************************************************
+
+.Cássio Marques
+[[cmarques]]
+***********************************************************
+Cássio Marques is a Brazilian software developer working with different programming languages such as Ruby, JavaScript, C++ and Java, as an independent consultant. He blogs at http://cassiomarques.wordpress.com, which is mainly written in portuguese, but will soon get a new section for posts with english translation.
+***********************************************************