diff options
author | Pablo Ifran <pabloifran@gmail.com> | 2012-10-22 09:42:42 -0200 |
---|---|---|
committer | Pablo Ifran <pabloifran@gmail.com> | 2012-10-22 09:42:42 -0200 |
commit | e041a50f2917f82950f9e5666f966d8992afd45d (patch) | |
tree | 9f4d2e3aa88f28dba9d7a1d24d46977e0642a1eb /activemodel/lib/active_model/validations.rb | |
parent | 3e6b2f5d38e0f31db3fb0fcd3bbab92666a0e3e2 (diff) | |
parent | ae27acb342c575ce19d5ad78cb13ba23f826fab1 (diff) | |
download | rails-e041a50f2917f82950f9e5666f966d8992afd45d.tar.gz rails-e041a50f2917f82950f9e5666f966d8992afd45d.tar.bz2 rails-e041a50f2917f82950f9e5666f966d8992afd45d.zip |
Merge branch 'master' of https://github.com/lifo/docrails
Conflicts:
activerecord/lib/active_record/callbacks.rb
Diffstat (limited to 'activemodel/lib/active_model/validations.rb')
-rw-r--r-- | activemodel/lib/active_model/validations.rb | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/activemodel/lib/active_model/validations.rb b/activemodel/lib/active_model/validations.rb index 243d911f71..81b44f97e0 100644 --- a/activemodel/lib/active_model/validations.rb +++ b/activemodel/lib/active_model/validations.rb @@ -3,10 +3,11 @@ require 'active_support/core_ext/hash/keys' require 'active_support/core_ext/hash/except' require 'active_model/errors' require 'active_model/validations/callbacks' +require 'active_model/validator' module ActiveModel - # == Active Model Validations + # == Active \Model Validations # # Provides a full validation framework to your objects. # @@ -233,7 +234,7 @@ module ActiveModel # # person = Person.new # person.valid? # => false - # person.errors # => #<ActiveModel::Errors:0x007fe603816640 @messages={:name=>["can't be blank"]}> + # person.errors # => #<ActiveModel::Errors:0x007fe603816640 @messages={:name=>["can't be blank"]}> def errors @errors ||= Errors.new(self) end @@ -250,7 +251,7 @@ module ActiveModel # # person = Person.new # person.name = '' - # person.valid? # => false + # person.valid? # => false # person.name = 'david' # person.valid? # => true # @@ -265,7 +266,7 @@ module ActiveModel # end # # person = Person.new - # person.valid? # => true + # person.valid? # => true # person.valid?(:new) # => false def valid?(context = nil) current_context, self.validation_context = validation_context, context @@ -287,7 +288,7 @@ module ActiveModel # # person = Person.new # person.name = '' - # person.invalid? # => true + # person.invalid? # => true # person.name = 'david' # person.invalid? # => false # @@ -302,7 +303,7 @@ module ActiveModel # end # # person = Person.new - # person.invalid? # => false + # person.invalid? # => false # person.invalid?(:new) # => true def invalid?(context = nil) !valid?(context) |