diff options
author | Ronak Jangir <ronakjangir47@gmail.com> | 2015-09-10 23:08:26 +0530 |
---|---|---|
committer | Ronak Jangir <ronakjangir47@gmail.com> | 2015-09-12 20:56:26 +0530 |
commit | 8fbd858c85f5f4c00a7a7d650dc61f4b54965069 (patch) | |
tree | 2abbe6cac46286e104bd622b0d6ab45758313b84 /activerecord/lib | |
parent | b455cadbfd0a272879c8703ba37375eb724aa493 (diff) | |
download | rails-8fbd858c85f5f4c00a7a7d650dc61f4b54965069.tar.gz rails-8fbd858c85f5f4c00a7a7d650dc61f4b54965069.tar.bz2 rails-8fbd858c85f5f4c00a7a7d650dc61f4b54965069.zip |
`restrict_with_error` message will now respect owner’s human name in any locale [kuboon & Ronak Jangir]
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/associations/has_many_association.rb | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/associations/has_one_association.rb | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/associations/has_many_association.rb b/activerecord/lib/active_record/associations/has_many_association.rb index f8211ef9fb..38bda0d2a5 100644 --- a/activerecord/lib/active_record/associations/has_many_association.rb +++ b/activerecord/lib/active_record/associations/has_many_association.rb @@ -15,7 +15,7 @@ module ActiveRecord when :restrict_with_error unless empty? - record = klass.human_attribute_name(reflection.name).downcase + record = owner.class.human_attribute_name(reflection.name).downcase message = owner.errors.generate_message(:base, :'restrict_dependent_destroy.many', record: record, raise: true) rescue nil if message ActiveSupport::Deprecation.warn(<<-MESSAGE.squish) diff --git a/activerecord/lib/active_record/associations/has_one_association.rb b/activerecord/lib/active_record/associations/has_one_association.rb index 1829453d73..b1e05c32b5 100644 --- a/activerecord/lib/active_record/associations/has_one_association.rb +++ b/activerecord/lib/active_record/associations/has_one_association.rb @@ -11,7 +11,7 @@ module ActiveRecord when :restrict_with_error if load_target - record = klass.human_attribute_name(reflection.name).downcase + record = owner.class.human_attribute_name(reflection.name).downcase message = owner.errors.generate_message(:base, :'restrict_dependent_destroy.one', record: record, raise: true) rescue nil if message ActiveSupport::Deprecation.warn(<<-MESSAGE.squish) |