Permalink
Browse files

Remove ambiguity with pluralizations and I18n keys used for associati…

…on restrict_dependent_destroy errors
  • Loading branch information...
1 parent 3af7b16 commit 26c2620a533fd03441c0edd994c6d153f4a3f3f5 @tigrish tigrish committed Jul 13, 2013
View
2 activerecord/lib/active_record/associations/has_many_association.rb
@@ -15,7 +15,7 @@ def handle_dependency
when :restrict_with_error
unless empty?
record = klass.human_attribute_name(reflection.name).downcase
- owner.errors.add(:base, :"restrict_dependent_destroy.many", record: record)
+ owner.errors.add(:base, :"restrict_dependent_destroy.has_many", record: record)
false
end
View
2 activerecord/lib/active_record/associations/has_one_association.rb
@@ -12,7 +12,7 @@ def handle_dependency
when :restrict_with_error
if load_target
record = klass.human_attribute_name(reflection.name).downcase
- owner.errors.add(:base, :"restrict_dependent_destroy.one", record: record)
+ owner.errors.add(:base, :"restrict_dependent_destroy.has_one", record: record)
false
end
View
4 activerecord/lib/active_record/locale/en.yml
@@ -15,8 +15,8 @@ en:
messages:
record_invalid: "Validation failed: %{errors}"
restrict_dependent_destroy:
- one: "Cannot delete record because a dependent %{record} exists"
- many: "Cannot delete record because dependent %{record} exist"
+ has_one: "Cannot delete record because a dependent %{record} exists"
+ has_many: "Cannot delete record because dependent %{record} exist"
# Append your own errors here or at the model/attributes scope.
# You can define own errors for models or model attributes.

0 comments on commit 26c2620

Please sign in to comment.