diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2014-08-29 14:54:08 -0700 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2014-08-29 14:54:08 -0700 |
commit | 7475b43cdbbbf7456e798210cb97ef20f2225166 (patch) | |
tree | 04ae517943ccc476ca0a8b9b3bdbb21949a558c1 /activemodel/lib | |
parent | 6a23bf0f4c33151e0cec0648e271dc6f5ab3f686 (diff) | |
parent | 4445478df311a74797d8dc4945c40662f9c1442a (diff) | |
download | rails-7475b43cdbbbf7456e798210cb97ef20f2225166.tar.gz rails-7475b43cdbbbf7456e798210cb97ef20f2225166.tar.bz2 rails-7475b43cdbbbf7456e798210cb97ef20f2225166.zip |
Merge branch 'master' of github.com:rails/rails
Diffstat (limited to 'activemodel/lib')
-rw-r--r-- | activemodel/lib/active_model/errors.rb | 4 | ||||
-rw-r--r-- | activemodel/lib/active_model/model.rb | 14 | ||||
-rw-r--r-- | activemodel/lib/active_model/validations/confirmation.rb | 2 |
3 files changed, 9 insertions, 11 deletions
diff --git a/activemodel/lib/active_model/errors.rb b/activemodel/lib/active_model/errors.rb index fc8034f9c7..1b46727351 100644 --- a/activemodel/lib/active_model/errors.rb +++ b/activemodel/lib/active_model/errors.rb @@ -251,11 +251,9 @@ module ActiveModel # person.errors.to_hash(true) # => {:name=>["name cannot be nil"]} def to_hash(full_messages = false) if full_messages - messages = {} - self.messages.each do |attribute, array| + self.messages.each_with_object({}) do |(attribute, array), messages| messages[attribute] = array.map { |message| full_message(attribute, message) } end - messages else self.messages.dup end diff --git a/activemodel/lib/active_model/model.rb b/activemodel/lib/active_model/model.rb index 640024eaa1..d51d6ddcc9 100644 --- a/activemodel/lib/active_model/model.rb +++ b/activemodel/lib/active_model/model.rb @@ -56,13 +56,13 @@ module ActiveModel # refer to the specific modules included in <tt>ActiveModel::Model</tt> # (see below). module Model - def self.included(base) #:nodoc: - base.class_eval do - extend ActiveModel::Naming - extend ActiveModel::Translation - include ActiveModel::Validations - include ActiveModel::Conversion - end + extend ActiveSupport::Concern + include ActiveModel::Validations + include ActiveModel::Conversion + + included do + extend ActiveModel::Naming + extend ActiveModel::Translation end # Initializes a new model with the given +params+. diff --git a/activemodel/lib/active_model/validations/confirmation.rb b/activemodel/lib/active_model/validations/confirmation.rb index a51523912f..1b11c28087 100644 --- a/activemodel/lib/active_model/validations/confirmation.rb +++ b/activemodel/lib/active_model/validations/confirmation.rb @@ -54,7 +54,7 @@ module ActiveModel # # Configuration options: # * <tt>:message</tt> - A custom error message (default is: "doesn't match - # confirmation"). + # <tt>%{translated_attribute_name}</tt>"). # # There is also a list of default options supported by every validator: # +:if+, +:unless+, +:on+, +:allow_nil+, +:allow_blank+, and +:strict+. |