aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib
diff options
context:
space:
mode:
authorVijay Dev <vijaydev.cse@gmail.com>2012-10-21 18:49:19 +0530
committerVijay Dev <vijaydev.cse@gmail.com>2012-10-21 18:49:19 +0530
commitf938019da210ea2bfccabdf61424852e8006c741 (patch)
tree7cd316340f230efe5b2d55b7df5a85232e5d5db5 /activemodel/lib
parentcec66e589f69a10ab9d6e4b62dd34ff09e5dc01b (diff)
parente84281398e79e09b637c888860fcefd6f82bf968 (diff)
downloadrails-f938019da210ea2bfccabdf61424852e8006c741.tar.gz
rails-f938019da210ea2bfccabdf61424852e8006c741.tar.bz2
rails-f938019da210ea2bfccabdf61424852e8006c741.zip
Merge branch 'master' of github.com:lifo/docrails
Conflicts: activesupport/lib/active_support/core_ext/hash/slice.rb guides/source/active_support_core_extensions.md
Diffstat (limited to 'activemodel/lib')
-rw-r--r--activemodel/lib/active_model/attribute_methods.rb2
-rw-r--r--activemodel/lib/active_model/callbacks.rb2
-rw-r--r--activemodel/lib/active_model/conversion.rb2
-rw-r--r--activemodel/lib/active_model/dirty.rb2
-rw-r--r--activemodel/lib/active_model/errors.rb2
-rw-r--r--activemodel/lib/active_model/lint.rb8
-rw-r--r--activemodel/lib/active_model/model.rb2
-rw-r--r--activemodel/lib/active_model/naming.rb2
-rw-r--r--activemodel/lib/active_model/observing.rb6
-rw-r--r--activemodel/lib/active_model/railtie.rb4
-rw-r--r--activemodel/lib/active_model/secure_password.rb6
-rw-r--r--activemodel/lib/active_model/serialization.rb2
-rw-r--r--activemodel/lib/active_model/translation.rb2
-rw-r--r--activemodel/lib/active_model/validations.rb2
-rw-r--r--activemodel/lib/active_model/validations/acceptance.rb2
-rw-r--r--activemodel/lib/active_model/validations/callbacks.rb2
-rw-r--r--activemodel/lib/active_model/validations/confirmation.rb2
-rw-r--r--activemodel/lib/active_model/validations/exclusion.rb2
-rw-r--r--activemodel/lib/active_model/validations/inclusion.rb2
-rw-r--r--activemodel/lib/active_model/validations/length.rb6
-rw-r--r--activemodel/lib/active_model/validations/numericality.rb4
-rw-r--r--activemodel/lib/active_model/validations/presence.rb4
-rw-r--r--activemodel/lib/active_model/validator.rb2
23 files changed, 35 insertions, 35 deletions
diff --git a/activemodel/lib/active_model/attribute_methods.rb b/activemodel/lib/active_model/attribute_methods.rb
index ef04f1fa49..a1d01b2c89 100644
--- a/activemodel/lib/active_model/attribute_methods.rb
+++ b/activemodel/lib/active_model/attribute_methods.rb
@@ -11,7 +11,7 @@ module ActiveModel
# # => ActiveModel::MissingAttributeError: missing attribute: user_id
class MissingAttributeError < NoMethodError
end
- # == Active Model Attribute Methods
+ # == Active \Model Attribute Methods
#
# <tt>ActiveModel::AttributeMethods</tt> provides a way to add prefixes and
# suffixes to your methods as well as handling the creation of Active Record
diff --git a/activemodel/lib/active_model/callbacks.rb b/activemodel/lib/active_model/callbacks.rb
index e442455a53..eab94554cc 100644
--- a/activemodel/lib/active_model/callbacks.rb
+++ b/activemodel/lib/active_model/callbacks.rb
@@ -1,7 +1,7 @@
require 'active_support/callbacks'
module ActiveModel
- # == Active Model Callbacks
+ # == Active \Model \Callbacks
#
# Provides an interface for any class to have Active Record like callbacks.
#
diff --git a/activemodel/lib/active_model/conversion.rb b/activemodel/lib/active_model/conversion.rb
index 48c53f0789..42de32e63e 100644
--- a/activemodel/lib/active_model/conversion.rb
+++ b/activemodel/lib/active_model/conversion.rb
@@ -1,7 +1,7 @@
require 'active_support/inflector'
module ActiveModel
- # == Active Model Conversions
+ # == Active \Model Conversions
#
# Handles default conversions: to_model, to_key, to_param, and to_partial_path.
#
diff --git a/activemodel/lib/active_model/dirty.rb b/activemodel/lib/active_model/dirty.rb
index c0b268fa4d..9d09353ef2 100644
--- a/activemodel/lib/active_model/dirty.rb
+++ b/activemodel/lib/active_model/dirty.rb
@@ -3,7 +3,7 @@ require 'active_support/hash_with_indifferent_access'
require 'active_support/core_ext/object/duplicable'
module ActiveModel
- # == Active Model Dirty
+ # == Active \Model \Dirty
#
# Provides a way to track changes in your object in the same way as
# Active Record does.
diff --git a/activemodel/lib/active_model/errors.rb b/activemodel/lib/active_model/errors.rb
index b3b9ba8e56..6510629248 100644
--- a/activemodel/lib/active_model/errors.rb
+++ b/activemodel/lib/active_model/errors.rb
@@ -4,7 +4,7 @@ require 'active_support/core_ext/array/conversions'
require 'active_support/core_ext/string/inflections'
module ActiveModel
- # == Active Model Errors
+ # == Active \Model \Errors
#
# Provides a modified +Hash+ that you can include in your object
# for handling error messages and interacting with Action Pack helpers.
diff --git a/activemodel/lib/active_model/lint.rb b/activemodel/lib/active_model/lint.rb
index 550fa474ea..1be2913f0b 100644
--- a/activemodel/lib/active_model/lint.rb
+++ b/activemodel/lib/active_model/lint.rb
@@ -1,8 +1,8 @@
module ActiveModel
module Lint
- # == Active Model Lint Tests
+ # == Active \Model \Lint \Tests
#
- # You can test whether an object is compliant with the Active Model API by
+ # You can test whether an object is compliant with the Active \Model API by
# including <tt>ActiveModel::Lint::Tests</tt> in your TestCase. It will
# include tests that tell you whether your object is fully compliant,
# or if not, which aspects of the API are not implemented.
@@ -71,7 +71,7 @@ module ActiveModel
assert_boolean model.persisted?, "persisted?"
end
- # == Naming
+ # == \Naming
#
# Model.model_name must return a string with some convenience methods:
# <tt>:human</tt>, <tt>:singular</tt> and <tt>:plural</tt>. Check
@@ -85,7 +85,7 @@ module ActiveModel
assert model_name.plural.respond_to?(:to_str)
end
- # == Errors Testing
+ # == \Errors Testing
#
# Returns an object that implements [](attribute) defined which returns an
# Array of Strings that are the errors for the attribute in question.
diff --git a/activemodel/lib/active_model/model.rb b/activemodel/lib/active_model/model.rb
index 33a530e6bd..62383a03e8 100644
--- a/activemodel/lib/active_model/model.rb
+++ b/activemodel/lib/active_model/model.rb
@@ -1,6 +1,6 @@
module ActiveModel
- # == Active Model Basic Model
+ # == Active \Model Basic \Model
#
# Includes the required interface for an object to interact with
# <tt>ActionPack</tt>, using different <tt>ActiveModel</tt> modules.
diff --git a/activemodel/lib/active_model/naming.rb b/activemodel/lib/active_model/naming.rb
index c0d93e5d53..eb8265d8c6 100644
--- a/activemodel/lib/active_model/naming.rb
+++ b/activemodel/lib/active_model/naming.rb
@@ -195,7 +195,7 @@ module ActiveModel
end
end
- # == Active Model Naming
+ # == Active \Model \Naming
#
# Creates a +model_name+ method on your object.
#
diff --git a/activemodel/lib/active_model/observing.rb b/activemodel/lib/active_model/observing.rb
index 9db7639ea3..9419645e7b 100644
--- a/activemodel/lib/active_model/observing.rb
+++ b/activemodel/lib/active_model/observing.rb
@@ -8,7 +8,7 @@ require 'active_support/core_ext/object/try'
require 'active_support/descendants_tracker'
module ActiveModel
- # == Active Model Observers Activation
+ # == Active \Model Observers Activation
module Observing
extend ActiveSupport::Concern
@@ -229,7 +229,7 @@ module ActiveModel
end
end
- # == Active Model Observers
+ # == Active \Model Observers
#
# Observer classes respond to life cycle callbacks to implement trigger-like
# behavior outside the original class. This is a great way to reduce the
@@ -257,7 +257,7 @@ module ActiveModel
#
# This Observer uses logger to log when specific callbacks are triggered.
#
- # == Observing a class that can't be inferred
+ # == \Observing a class that can't be inferred
#
# Observers will by default be mapped to the class with which they share a
# name. So <tt>CommentObserver</tt> will be tied to observing <tt>Comment</tt>,
diff --git a/activemodel/lib/active_model/railtie.rb b/activemodel/lib/active_model/railtie.rb
index f239758b35..75cde900e3 100644
--- a/activemodel/lib/active_model/railtie.rb
+++ b/activemodel/lib/active_model/railtie.rb
@@ -2,7 +2,7 @@ require "active_model"
require "rails"
module ActiveModel
- class Railtie < Rails::Railtie
+ class Railtie < Rails::Railtie # :nodoc:
config.eager_load_namespaces << ActiveModel
end
-end \ No newline at end of file
+end
diff --git a/activemodel/lib/active_model/secure_password.rb b/activemodel/lib/active_model/secure_password.rb
index d011402081..4b328b399a 100644
--- a/activemodel/lib/active_model/secure_password.rb
+++ b/activemodel/lib/active_model/secure_password.rb
@@ -44,7 +44,7 @@ module ActiveModel
if options.fetch(:validations, true)
validates_confirmation_of :password
validates_presence_of :password, :on => :create
-
+
before_create { raise "Password digest missing on new record" if password_digest.blank? }
end
@@ -68,7 +68,7 @@ module ActiveModel
# user = User.new(name: 'david', password: 'mUc3m00RsqyRe')
# user.save
# user.authenticate('notright') # => false
- #  user.authenticate('mUc3m00RsqyRe') # => user
+ # user.authenticate('mUc3m00RsqyRe') # => user
def authenticate(unencrypted_password)
BCrypt::Password.new(password_digest) == unencrypted_password && self
end
@@ -84,7 +84,7 @@ module ActiveModel
# user.password = nil
# user.password_digest # => nil
# user.password = 'mUc3m00RsqyRe'
- # user.password_digest # => "$2a$10$4LEA7r4YmNHtvlAvHhsYAeZmk/xeUVtMTYqwIvYY76EW5GUqDiP4."
+ # user.password_digest # => "$2a$10$4LEA7r4YmNHtvlAvHhsYAeZmk/xeUVtMTYqwIvYY76EW5GUqDiP4."
def password=(unencrypted_password)
unless unencrypted_password.blank?
@password = unencrypted_password
diff --git a/activemodel/lib/active_model/serialization.rb b/activemodel/lib/active_model/serialization.rb
index 8a63014ffb..dfd68a90fd 100644
--- a/activemodel/lib/active_model/serialization.rb
+++ b/activemodel/lib/active_model/serialization.rb
@@ -2,7 +2,7 @@ require 'active_support/core_ext/hash/except'
require 'active_support/core_ext/hash/slice'
module ActiveModel
- # == Active Model Serialization
+ # == Active \Model \Serialization
#
# Provides a basic serialization to a serializable_hash for your object.
#
diff --git a/activemodel/lib/active_model/translation.rb b/activemodel/lib/active_model/translation.rb
index 7a86701f73..0d098ba93d 100644
--- a/activemodel/lib/active_model/translation.rb
+++ b/activemodel/lib/active_model/translation.rb
@@ -1,6 +1,6 @@
module ActiveModel
- # == Active Model Translation
+ # == Active \Model \Translation
#
# Provides integration between your object and the Rails internationalization
# (i18n) framework.
diff --git a/activemodel/lib/active_model/validations.rb b/activemodel/lib/active_model/validations.rb
index 9e6ec17ce1..81b44f97e0 100644
--- a/activemodel/lib/active_model/validations.rb
+++ b/activemodel/lib/active_model/validations.rb
@@ -7,7 +7,7 @@ require 'active_model/validator'
module ActiveModel
- # == Active Model Validations
+ # == Active \Model Validations
#
# Provides a full validation framework to your objects.
#
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
diff --git a/activemodel/lib/active_model/validator.rb b/activemodel/lib/active_model/validator.rb
index 85aec00f25..09da4cc93d 100644
--- a/activemodel/lib/active_model/validator.rb
+++ b/activemodel/lib/active_model/validator.rb
@@ -2,7 +2,7 @@ require "active_support/core_ext/module/anonymous"
module ActiveModel
- # == Active Model Validator
+ # == Active \Model \Validator
#
# A simple base class that can be used along with
# ActiveModel::Validations::ClassMethods.validates_with