diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-10-18 05:32:01 -0700 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-10-18 05:32:01 -0700 |
commit | c1e080d515af180f6bf92ab83d7af23819e2a063 (patch) | |
tree | 7e134ad560dac3a3826d8ba37b0a70b76b7dc381 | |
parent | fc32ff4ee322d46c6658a6a2d484fd5f60c07178 (diff) | |
parent | a06012c81fc9e13dea0a549ee7cdb2074e058d3e (diff) | |
download | rails-c1e080d515af180f6bf92ab83d7af23819e2a063.tar.gz rails-c1e080d515af180f6bf92ab83d7af23819e2a063.tar.bz2 rails-c1e080d515af180f6bf92ab83d7af23819e2a063.zip |
Merge pull request #7969 from senny/active_model_validations_requires_necessary_files
active_model/validations requires necessary files to run
-rw-r--r-- | activemodel/lib/active_model/validations.rb | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/activemodel/lib/active_model/validations.rb b/activemodel/lib/active_model/validations.rb index 243d911f71..9e6ec17ce1 100644 --- a/activemodel/lib/active_model/validations.rb +++ b/activemodel/lib/active_model/validations.rb @@ -3,6 +3,7 @@ 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 @@ -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) |