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 | |
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')
8 files changed, 12 insertions, 12 deletions
diff --git a/activemodel/lib/active_model/validations/acceptance.rb b/activemodel/lib/active_model/validations/acceptance.rb index 8d5ebf527f..ec7ad4b048 100644 --- a/activemodel/lib/active_model/validations/acceptance.rb +++ b/activemodel/lib/active_model/validations/acceptance.rb @@ -1,6 +1,6 @@ module ActiveModel - # == Active Model Acceptance Validator + # == Active \Model Acceptance \Validator module Validations class AcceptanceValidator < EachValidator #:nodoc: def initialize(options) diff --git a/activemodel/lib/active_model/validations/callbacks.rb b/activemodel/lib/active_model/validations/callbacks.rb index c153ef4309..a8fb4fdfc2 100644 --- a/activemodel/lib/active_model/validations/callbacks.rb +++ b/activemodel/lib/active_model/validations/callbacks.rb @@ -2,7 +2,7 @@ require 'active_support/callbacks' module ActiveModel module Validations - # == Active Model Validation callbacks + # == Active \Model Validation Callbacks # # Provides an interface for any class to have +before_validation+ and # +after_validation+ callbacks. diff --git a/activemodel/lib/active_model/validations/confirmation.rb b/activemodel/lib/active_model/validations/confirmation.rb index baa034eca6..4071589747 100644 --- a/activemodel/lib/active_model/validations/confirmation.rb +++ b/activemodel/lib/active_model/validations/confirmation.rb @@ -1,6 +1,6 @@ module ActiveModel - # == Active Model Confirmation Validator + # == Active \Model Confirmation \Validator module Validations class ConfirmationValidator < EachValidator #:nodoc: def validate_each(record, attribute, value) diff --git a/activemodel/lib/active_model/validations/exclusion.rb b/activemodel/lib/active_model/validations/exclusion.rb index 3ec552c372..7a90750c49 100644 --- a/activemodel/lib/active_model/validations/exclusion.rb +++ b/activemodel/lib/active_model/validations/exclusion.rb @@ -2,7 +2,7 @@ require "active_model/validations/clusivity" module ActiveModel - # == Active Model Exclusion Validator + # == Active \Model Exclusion \Validator module Validations class ExclusionValidator < EachValidator #:nodoc: include Clusivity diff --git a/activemodel/lib/active_model/validations/inclusion.rb b/activemodel/lib/active_model/validations/inclusion.rb index babc8982da..a333a09976 100644 --- a/activemodel/lib/active_model/validations/inclusion.rb +++ b/activemodel/lib/active_model/validations/inclusion.rb @@ -2,7 +2,7 @@ require "active_model/validations/clusivity" module ActiveModel - # == Active Model Inclusion Validator + # == Active \Model Inclusion \Validator module Validations class InclusionValidator < EachValidator #:nodoc: include Clusivity diff --git a/activemodel/lib/active_model/validations/length.rb b/activemodel/lib/active_model/validations/length.rb index e4a1f9e80a..70ef589cd7 100644 --- a/activemodel/lib/active_model/validations/length.rb +++ b/activemodel/lib/active_model/validations/length.rb @@ -1,8 +1,8 @@ module ActiveModel - # == Active Model Length Validator + # == Active \Model Length \Validator module Validations - class LengthValidator < EachValidator #:nodoc: + class LengthValidator < EachValidator # :nodoc: MESSAGES = { :is => :wrong_length, :minimum => :too_short, :maximum => :too_long }.freeze CHECKS = { :is => :==, :minimum => :>=, :maximum => :<= }.freeze @@ -37,7 +37,7 @@ module ActiveModel value = tokenize(value) value_length = value.respond_to?(:length) ? value.length : value.to_s.length errors_options = options.except(*RESERVED_OPTIONS) - + CHECKS.each do |key, validity_check| next unless check_value = options[key] next if value_length.send(validity_check, check_value) diff --git a/activemodel/lib/active_model/validations/numericality.rb b/activemodel/lib/active_model/validations/numericality.rb index edebca94a8..ffd045a8fb 100644 --- a/activemodel/lib/active_model/validations/numericality.rb +++ b/activemodel/lib/active_model/validations/numericality.rb @@ -1,8 +1,8 @@ module ActiveModel - # == Active Model Numericality Validator + # == Active \Model Numericality \Validator module Validations - class NumericalityValidator < EachValidator #:nodoc: + class NumericalityValidator < EachValidator # :nodoc: CHECKS = { :greater_than => :>, :greater_than_or_equal_to => :>=, :equal_to => :==, :less_than => :<, :less_than_or_equal_to => :<=, :odd => :odd?, :even => :even?, :other_than => :!= }.freeze diff --git a/activemodel/lib/active_model/validations/presence.rb b/activemodel/lib/active_model/validations/presence.rb index f159e40858..70247ee4c8 100644 --- a/activemodel/lib/active_model/validations/presence.rb +++ b/activemodel/lib/active_model/validations/presence.rb @@ -1,9 +1,9 @@ module ActiveModel - # == Active Model Presence Validator + # == Active \Model Presence \Validator module Validations - class PresenceValidator < EachValidator #:nodoc: + class PresenceValidator < EachValidator # :nodoc: def validate(record) record.errors.add_on_blank(attributes, options) end |