diff options
author | Martin Larochelle <martin.larochelle@shopify.com> | 2018-05-22 17:20:14 -0400 |
---|---|---|
committer | Martin Larochelle <martin.larochelle@shopify.com> | 2018-06-05 13:25:24 -0400 |
commit | 32513c4b356ed8b87b2c9caec6354b4b21cfc692 (patch) | |
tree | 3222d572500a931eefc425312bce82cac13f83bc /activemodel/lib/active_model/errors.rb | |
parent | 7d09874a71ecceb929a99f914b703adc16d80e83 (diff) | |
download | rails-32513c4b356ed8b87b2c9caec6354b4b21cfc692.tar.gz rails-32513c4b356ed8b87b2c9caec6354b4b21cfc692.tar.bz2 rails-32513c4b356ed8b87b2c9caec6354b4b21cfc692.zip |
Add global config for config.active_model.i18n_full_message
Diffstat (limited to 'activemodel/lib/active_model/errors.rb')
-rw-r--r-- | activemodel/lib/active_model/errors.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/activemodel/lib/active_model/errors.rb b/activemodel/lib/active_model/errors.rb index e813629855..d583d48b54 100644 --- a/activemodel/lib/active_model/errors.rb +++ b/activemodel/lib/active_model/errors.rb @@ -62,6 +62,11 @@ module ActiveModel CALLBACKS_OPTIONS = [:if, :unless, :on, :allow_nil, :allow_blank, :strict] MESSAGE_OPTIONS = [:message] + class << self + attr_accessor :i18n_full_message # :nodoc: + end + self.i18n_full_message = false + attr_reader :messages, :details # Pass in the instance of the object that is using the errors object. @@ -375,7 +380,7 @@ module ActiveModel def full_message(attribute, message) return message if attribute == :base - if @base.class.respond_to?(:i18n_scope) + if self.class.i18n_full_message && @base.class.respond_to?(:i18n_scope) parts = attribute.to_s.split(".") attribute_name = parts.pop namespace = parts.join("/") unless parts.empty? |