aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib
diff options
context:
space:
mode:
authorZamith <zamith.28@gmail.com>2015-05-04 13:36:26 +0100
committerZamith <zamith.28@gmail.com>2015-05-04 13:36:26 +0100
commit6f418a09d82351ae74409379f80012f717aa9cb0 (patch)
tree58f68e5f6129e30c2e305e3f4797fdbe59ae22aa /activemodel/lib
parent21c74bd769f6c873453e9244b0de7ced40a532be (diff)
downloadrails-6f418a09d82351ae74409379f80012f717aa9cb0.tar.gz
rails-6f418a09d82351ae74409379f80012f717aa9cb0.tar.bz2
rails-6f418a09d82351ae74409379f80012f717aa9cb0.zip
Adds/Corrects use case for adding an error message
I believe this is a use case that was supposed to be supported, and it's a small fix.
Diffstat (limited to 'activemodel/lib')
-rw-r--r--activemodel/lib/active_model/errors.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activemodel/lib/active_model/errors.rb b/activemodel/lib/active_model/errors.rb
index f843b279ce..287a2559d2 100644
--- a/activemodel/lib/active_model/errors.rb
+++ b/activemodel/lib/active_model/errors.rb
@@ -452,7 +452,6 @@ module ActiveModel
defaults = []
end
- defaults << options.delete(:message)
defaults << :"#{@base.class.i18n_scope}.errors.messages.#{type}" if @base.class.respond_to?(:i18n_scope)
defaults << :"errors.attributes.#{attribute}.#{type}"
defaults << :"errors.messages.#{type}"
@@ -461,6 +460,7 @@ module ActiveModel
defaults.flatten!
key = defaults.shift
+ defaults = options.delete(:message) if options[:message]
value = (attribute != :base ? @base.send(:read_attribute_for_validation, attribute) : nil)
options = {