Skip to content
Browse files

Merge pull request #7995 from adimichele/master

Small change to active_record/locale/en.yml
  • Loading branch information...
2 parents c50de96 + f48b7cc commit 5341b84936d93ec90e6252af437a3871101c115a @rafaelfranca rafaelfranca committed
View
6 activerecord/lib/active_record/locale/en.yml
@@ -4,11 +4,15 @@ en:
#created_at: "Created at"
#updated_at: "Updated at"
+ # Default error messages
+ errors:
+ messages:
+ taken: "has already been taken"
+
# Active Record models configuration
activerecord:
errors:
messages:
- taken: "has already been taken"
@rubys
rubys added a note

This change probably should be noted in the release notes.

Meanwhile, I've updated the Agile Web Development with Rails tests:

rubys/awdwr@598865c#L0R425

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
record_invalid: "Validation failed: %{errors}"
restrict_dependent_destroy:
one: "Cannot delete record because a dependent %{record} exists"
View
5 activerecord/test/cases/validations/i18n_generate_message_validation_test.rb
@@ -54,4 +54,9 @@ def test_generate_message_taken_with_custom_message
end
end
+ test "translation for 'taken' can be overridden" do
+ I18n.backend.store_translations "en", {errors: {attributes: {title: {taken: "Custom taken message" }}}}
+ assert_equal "Custom taken message", @topic.errors.generate_message(:title, :taken, :value => 'title')
+ end
+
end

0 comments on commit 5341b84

Please sign in to comment.
Something went wrong with that request. Please try again.