{"action":"opened","issue":{"url":"https://api.github.com/repos/thoughtbot/administrate/issues/1042","repository_url":"https://api.github.com/repos/thoughtbot/administrate","labels_url":"https://api.github.com/repos/thoughtbot/administrate/issues/1042/labels{/name}","comments_url":"https://api.github.com/repos/thoughtbot/administrate/issues/1042/comments","events_url":"https://api.github.com/repos/thoughtbot/administrate/issues/1042/events","html_url":"https://github.com/thoughtbot/administrate/issues/1042","id":279152853,"number":1042,"title":"HasMany index partial passes an already-pluralized field name to pluralize helper","user":{"login":"tbroadley","id":8731922,"avatar_url":"https://avatars0.githubusercontent.com/u/8731922?v=4","gravatar_id":"","url":"https://api.github.com/users/tbroadley","html_url":"https://github.com/tbroadley","followers_url":"https://api.github.com/users/tbroadley/followers","following_url":"https://api.github.com/users/tbroadley/following{/other_user}","gists_url":"https://api.github.com/users/tbroadley/gists{/gist_id}","starred_url":"https://api.github.com/users/tbroadley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tbroadley/subscriptions","organizations_url":"https://api.github.com/users/tbroadley/orgs","repos_url":"https://api.github.com/users/tbroadley/repos","events_url":"https://api.github.com/users/tbroadley/events{/privacy}","received_events_url":"https://api.github.com/users/tbroadley/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-12-04T21:17:09Z","updated_at":"2017-12-04T21:17:09Z","closed_at":null,"author_association":"NONE","body":"[The HasMany index partial](https://github.com/thoughtbot/administrate/blob/6661889711edd688c8768e48602fa4a25b82d7bf/app/views/fields/has_many/_index.html.erb) includes one line of code:\r\n\r\n```erb\r\n<%= pluralize(field.data.size, field.attribute.to_s.humanize.downcase) %>\r\n```\r\n\r\nIn this partial, `field` is an instance of `Administrate::Field::HasMany`, so `field.attribute` returns the pluralized name of a model, e.g. \"teams\". When `field.data.size == 1`, the partial renders `pluralize(1, 'teams')` which equals `'1 teams'`, instead of `'1 team'` which is what I would expect.\r\n\r\nTo fix this, I would suggest using the following as the body of the partial instead:\r\n\r\n```erb\r\n<%= pluralize(field.data.size, field.attribute.to_s.humanize.downcase.singularize) %>\r\n```"}}
{"actor":{"display_login":"tbroadley"}}