aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/active_record_validations.md
diff options
context:
space:
mode:
authorVijay Dev <vijaydev.cse@gmail.com>2013-06-14 01:14:56 +0530
committerVijay Dev <vijaydev.cse@gmail.com>2013-06-14 01:14:56 +0530
commit41a398f859cc46430cb3b655d44c0cb3b41e42ae (patch)
tree1fefe6aa5560b49ca2142866080caaedaf2bf04d /guides/source/active_record_validations.md
parent930d0e129c730292ab987eaaf1cd2ba8094e580b (diff)
parent2f0a5c7ac506b900d101620c4cc338a88ee620e3 (diff)
downloadrails-41a398f859cc46430cb3b655d44c0cb3b41e42ae.tar.gz
rails-41a398f859cc46430cb3b655d44c0cb3b41e42ae.tar.bz2
rails-41a398f859cc46430cb3b655d44c0cb3b41e42ae.zip
Merge branch 'master' of github.com:lifo/docrails
Conflicts: guides/source/upgrading_ruby_on_rails.md
Diffstat (limited to 'guides/source/active_record_validations.md')
-rw-r--r--guides/source/active_record_validations.md10
1 files changed, 5 insertions, 5 deletions
diff --git a/guides/source/active_record_validations.md b/guides/source/active_record_validations.md
index f10f0254e5..37790c62b1 100644
--- a/guides/source/active_record_validations.md
+++ b/guides/source/active_record_validations.md
@@ -243,7 +243,7 @@ line of code you can add the same kind of validation to several attributes.
All of them accept the `:on` and `:message` options, which define when the
validation should be run and what message should be added to the `errors`
collection if it fails, respectively. The `:on` option takes one of the values
-`:save` (the default), `:create` or `:update`. There is a default error
+`:save` (the default), `:create` or `:update`. There is a default error
message for each one of the validation helpers. These messages are used when
the `:message` option isn't specified. Let's take a look at each one of the
available helpers.
@@ -677,13 +677,13 @@ class GoodnessValidator
def initialize(person)
@person = person
end
-
+
def validate
if some_complex_condition_involving_ivars_and_private_methods?
@person.errors[:base] << "This person is evil"
end
end
-
+
# …
end
```
@@ -736,8 +736,8 @@ class Topic < ActiveRecord::Base
validates :title, length: { is: 5 }, allow_blank: true
end
-Topic.create("title" => "").valid? # => true
-Topic.create("title" => nil).valid? # => true
+Topic.create(title: "").valid? # => true
+Topic.create(title: nil).valid? # => true
```
### `:message`