diff options
author | Xavier Noria <fxn@hashref.com> | 2011-03-07 22:11:47 +0100 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2011-03-07 22:11:47 +0100 |
commit | 89ecc0a5dc1d06a6bbd2a59edd57187c6eedf8af (patch) | |
tree | 762f7860f65b7e058016707ef6771b1ff2feb7cb /activemodel/lib | |
parent | 5968d7a65886d3450698889f685eccaf54749f43 (diff) | |
parent | f99db5a6a8295b463325accaefe53ab6c89c9982 (diff) | |
download | rails-89ecc0a5dc1d06a6bbd2a59edd57187c6eedf8af.tar.gz rails-89ecc0a5dc1d06a6bbd2a59edd57187c6eedf8af.tar.bz2 rails-89ecc0a5dc1d06a6bbd2a59edd57187c6eedf8af.zip |
Merge branch 'master' of git://github.com/lifo/docrails
Diffstat (limited to 'activemodel/lib')
-rw-r--r-- | activemodel/lib/active_model/conversion.rb | 2 | ||||
-rw-r--r-- | activemodel/lib/active_model/mass_assignment_security.rb | 4 | ||||
-rw-r--r-- | activemodel/lib/active_model/validations.rb | 6 | ||||
-rw-r--r-- | activemodel/lib/active_model/validations/with.rb | 4 | ||||
-rw-r--r-- | activemodel/lib/active_model/validator.rb | 27 |
5 files changed, 18 insertions, 25 deletions
diff --git a/activemodel/lib/active_model/conversion.rb b/activemodel/lib/active_model/conversion.rb index ae0ab93e97..e3992e842a 100644 --- a/activemodel/lib/active_model/conversion.rb +++ b/activemodel/lib/active_model/conversion.rb @@ -3,8 +3,6 @@ module ActiveModel # # Handles default conversions: to_model, to_key and to_param. # - # == Example - # # Let's take for example this non persisted object. # # class ContactMessage diff --git a/activemodel/lib/active_model/mass_assignment_security.rb b/activemodel/lib/active_model/mass_assignment_security.rb index 97e31d4243..be48415739 100644 --- a/activemodel/lib/active_model/mass_assignment_security.rb +++ b/activemodel/lib/active_model/mass_assignment_security.rb @@ -54,9 +54,7 @@ module ActiveModel # Mass-assignment to these attributes will simply be ignored, to assign # to them you can use direct writer methods. This is meant to protect # sensitive attributes from being overwritten by malicious users - # tampering with URLs or forms. - # - # == Example + # tampering with URLs or forms. Example: # # class Customer # include ActiveModel::MassAssignmentSecurity diff --git a/activemodel/lib/active_model/validations.rb b/activemodel/lib/active_model/validations.rb index 98af88b5a0..d968609e67 100644 --- a/activemodel/lib/active_model/validations.rb +++ b/activemodel/lib/active_model/validations.rb @@ -36,8 +36,8 @@ module ActiveModel # person.invalid? # => true # person.errors # => #<OrderedHash {:first_name=>["starts with z."]}> # - # Note that ActiveModel::Validations automatically adds an +errors+ method - # to your instances initialized with a new ActiveModel::Errors object, so + # Note that <tt>ActiveModel::Validations</tt> automatically adds an +errors+ method + # to your instances initialized with a new <tt>ActiveModel::Errors</tt> object, so # there is no need for you to do this manually. # module Validations @@ -165,7 +165,7 @@ module ActiveModel end end - # Returns the Errors object that holds all information about attribute error messages. + # Returns the +Errors+ object that holds all information about attribute error messages. def errors @errors ||= Errors.new(self) end diff --git a/activemodel/lib/active_model/validations/with.rb b/activemodel/lib/active_model/validations/with.rb index 1663697727..65ae18a769 100644 --- a/activemodel/lib/active_model/validations/with.rb +++ b/activemodel/lib/active_model/validations/with.rb @@ -50,9 +50,9 @@ module ActiveModel # end # # Configuration options: - # * <tt>on</tt> - Specifies when this validation is active + # * <tt>:on</tt> - Specifies when this validation is active # (<tt>:create</tt> or <tt>:update</tt> - # * <tt>if</tt> - Specifies a method, proc or string to call to determine + # * <tt>:if</tt> - Specifies a method, proc or string to call to determine # if the validation should occur (e.g. <tt>:if => :allow_validation</tt>, # or <tt>:if => Proc.new { |user| user.signup_step > 2 }</tt>). # The method, proc or string should return or evaluate to a true or false value. diff --git a/activemodel/lib/active_model/validator.rb b/activemodel/lib/active_model/validator.rb index 0168233fce..1c6123eb09 100644 --- a/activemodel/lib/active_model/validator.rb +++ b/activemodel/lib/active_model/validator.rb @@ -63,7 +63,7 @@ module ActiveModel #:nodoc: # end # # The easiest way to add custom validators for validating individual attributes - # is with the convenient ActiveModel::EachValidator for example: + # is with the convenient <tt>ActiveModel::EachValidator</tt>. For example: # # class TitleValidator < ActiveModel::EachValidator # def validate_each(record, attribute, value) @@ -72,18 +72,18 @@ module ActiveModel #:nodoc: # end # # This can now be used in combination with the +validates+ method - # (see ActiveModel::Validations::ClassMethods.validates for more on this) + # (see <tt>ActiveModel::Validations::ClassMethods.validates</tt> for more on this) # # class Person # include ActiveModel::Validations # attr_accessor :title # - # validates :title, :presence => true, :title => true + # validates :title, :presence => true # end # # Validator may also define a +setup+ instance method which will get called - # with the class that using that validator as it's argument. This can be - # useful when there are prerequisites such as an attr_accessor being present + # with the class that using that validator as its argument. This can be + # useful when there are prerequisites such as an +attr_accessor+ being present # for example: # # class MyValidator < ActiveModel::Validator @@ -98,9 +98,7 @@ module ActiveModel #:nodoc: class Validator attr_reader :options - # Returns the kind of the validator. - # - # == Examples + # Returns the kind of the validator. Examples: # # PresenceValidator.kind # => :presence # UniquenessValidator.kind # => :uniqueness @@ -126,11 +124,11 @@ module ActiveModel #:nodoc: end end - # EachValidator is a validator which iterates through the attributes given - # in the options hash invoking the validate_each method passing in the + # +EachValidator+ is a validator which iterates through the attributes given + # in the options hash invoking the <tt>validate_each</tt> method passing in the # record, attribute and value. # - # All Active Model validations are built on top of this Validator. + # All Active Model validations are built on top of this validator. class EachValidator < Validator attr_reader :attributes @@ -163,14 +161,13 @@ module ActiveModel #:nodoc: # Hook method that gets called by the initializer allowing verification # that the arguments supplied are valid. You could for example raise an - # ArgumentError when invalid options are supplied. + # +ArgumentError+ when invalid options are supplied. def check_validity! end end - # BlockValidator is a special EachValidator which receives a block on initialization - # and call this block for each attribute being validated. +validates_each+ uses this - # Validator. + # +BlockValidator+ is a special +EachValidator+ which receives a block on initialization + # and call this block for each attribute being validated. +validates_each+ uses this validator. class BlockValidator < EachValidator def initialize(options, &block) @block = block |