Permalink
Browse files

Merge pull request #7969 from senny/active_model_validations_requires…

…_necessary_files

active_model/validations requires necessary files to run
  • Loading branch information...
2 parents fc32ff4 + a06012c commit c1e080d515af180f6bf92ab83d7af23819e2a063 @rafaelfranca rafaelfranca committed Oct 18, 2012
Showing with 6 additions and 5 deletions.
  1. +6 −5 activemodel/lib/active_model/validations.rb
@@ -3,6 +3,7 @@
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 @@ def initialize_dup(other) #:nodoc:
#
# 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 @@ def errors
#
# person = Person.new
# person.name = ''
- # person.valid? # => false
+ # person.valid? # => false
# person.name = 'david'
# person.valid? # => true
#
@@ -265,7 +266,7 @@ def errors
# 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 @@ def valid?(context = nil)
#
# person = Person.new
# person.name = ''
- # person.invalid? # => true
+ # person.invalid? # => true
# person.name = 'david'
# person.invalid? # => false
#
@@ -302,7 +303,7 @@ def valid?(context = nil)
# end
#
# person = Person.new
- # person.invalid? # => false
+ # person.invalid? # => false
# person.invalid?(:new) # => true
def invalid?(context = nil)
!valid?(context)

0 comments on commit c1e080d

Please sign in to comment.