Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate the keys for association restrict_dependent_destroy errors in favor of new key names #20668

Merged

Conversation

repinel
Copy link
Member

@repinel repinel commented Jun 23, 2015

As suggested by #11658 (comment), it deprecates the restrict_dependent_destroy errors keys in favor of better key names.

The :'restrict_dependent_destroy.one' key should be replaced with :'restrict_dependent_destroy.has_one', and :'restrict_dependent_destroy.many' with :'restrict_dependent_destroy.has_many'.

@rafaelfranca Is this what you expected?

Closes #11658

@repinel repinel force-pushed the rename-restrict-dependent-destroy-i18n-key branch 3 times, most recently from 9911b08 to f13500c Compare Jun 30, 2015
@repinel
Copy link
Member Author

repinel commented Jul 10, 2015

@rafaelfranca What do you think?

@repinel repinel force-pushed the rename-restrict-dependent-destroy-i18n-key branch from f13500c to fd3a8c2 Compare Jul 21, 2015
@repinel
Copy link
Member Author

repinel commented Jul 21, 2015

@rafaelfranca Is this one still valid?

(sorry for the multiples pings)

@rafaelfranca
Copy link
Member

rafaelfranca commented Jul 21, 2015

(sorry for the multiples pings)

No problem at all. I way back in my backlog lately.

assert !firm.errors.empty?

assert_equal 'message for deprecated key', firm.errors[:base].first
assert RestrictedWithErrorFirm.exists?(:name => 'restrict')
Copy link
Member

@rafaelfranca rafaelfranca Jul 21, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New hash syntax.

Previously `has_one` and `has_many` associations were using the
`one` and `many` keys respectively. Both of these keys have special
meaning in I18n (they are considered to be pluralizations) so by
renaming them to `has_one` and `has_many` we make the messages more
explicit and most importantly they don't clash with linguistical
systems that need to validate translation keys (and their
pluralizations).

The `:'restrict_dependent_destroy.one'` key should be replaced with
`:'restrict_dependent_destroy.has_one'`, and
`:'restrict_dependent_destroy.many'` with
`:'restrict_dependent_destroy.has_many'`.

[Roque Pinel & Christopher Dell]
@repinel repinel force-pushed the rename-restrict-dependent-destroy-i18n-key branch from fd3a8c2 to b184398 Compare Jul 21, 2015
@repinel
Copy link
Member Author

repinel commented Jul 21, 2015

@rafaelfranca I fixed the hash syntax.

rafaelfranca added a commit that referenced this pull request Jul 21, 2015
…roy-i18n-key

Deprecate the keys for association `restrict_dependent_destroy` errors in favor of new key names
@rafaelfranca rafaelfranca merged commit 36ea89a into rails:master Jul 21, 2015
@repinel
Copy link
Member Author

repinel commented Jul 21, 2015

💚 💛 💙

@repinel repinel deleted the rename-restrict-dependent-destroy-i18n-key branch Jul 21, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants