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

Undeprecate plural positional argument #26578

Merged
merged 1 commit into from
Oct 10, 2016

Conversation

jeremy
Copy link
Member

@jeremy jeremy commented Sep 22, 2016

DEPRECATION WARNING: Passing plural as a positional argument is deprecated and will be removed in Rails 5.1. Use e.g. pluralize(1, 'person', plural: 'people') instead.

This is a rough deprecation warning. Unclear why it's removed, and it turns out it's just for calling consistency with other helpers. I don't think that flies in this case. Passing one as an unlabeled positional argument and the other as a keyword arg over-emphasizes that one is required (the singular form) and the other is not (since we use the inflector to generate a plural if it's not provided).

Concise and natural to read and write:

pluralize people.count, 'person', 'people'

Surprise that one of the nouns needs labeling:

pluralize people.count, 'person', plural: 'people'

So let's just not deprecate the positional arg. (The plural: kwarg shipped in 5.0.0, so we're keeping it.)

We could optionally label both nouns, but that's a mega mouthful:

pluralize people.count, singular: 'person', plural: 'people'

Partially reverts #20638.

```ruby
pluralize people.count, 'person', 'people'
```
reads more naturally than
```ruby
pluralize people.count, 'person', plural: 'people'
```
so let's not deprecate it.

We could label both, but that's a mouthful:
```ruby
pluralize people.count, singular: 'person', plural: 'people'
```

(The `plural:` kwarg shipped in 5.0.0, so we're keeping it.)
Copy link
Contributor

@kaspth kaspth left a comment

Choose a reason for hiding this comment

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

Neat, and right on the 💸! Wish I'd caught it then, but live and learn 😄

@rafaelfranca rafaelfranca merged commit a50cd3e into rails:master Oct 10, 2016
rafaelfranca added a commit that referenced this pull request Oct 10, 2016
@rafaelfranca
Copy link
Member

Merged because I almost removed this code from master 😅 . Backported in d621a26

@jeremy jeremy deleted the undeprecate-plural-positional-arg branch October 10, 2016 05:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants