{"action":"created","issue":{"url":"https://api.github.com/repos/rails/rails/issues/17511","labels_url":"https://api.github.com/repos/rails/rails/issues/17511/labels{/name}","comments_url":"https://api.github.com/repos/rails/rails/issues/17511/comments","events_url":"https://api.github.com/repos/rails/rails/issues/17511/events","html_url":"https://github.com/rails/rails/issues/17511","id":47784592,"number":17511,"title":"Active Record Enum - Same values, different columns","user":{"login":"dgsan","id":313910,"avatar_url":"https://avatars.githubusercontent.com/u/313910?v=3","gravatar_id":"","url":"https://api.github.com/users/dgsan","html_url":"https://github.com/dgsan","followers_url":"https://api.github.com/users/dgsan/followers","following_url":"https://api.github.com/users/dgsan/following{/other_user}","gists_url":"https://api.github.com/users/dgsan/gists{/gist_id}","starred_url":"https://api.github.com/users/dgsan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dgsan/subscriptions","organizations_url":"https://api.github.com/users/dgsan/orgs","repos_url":"https://api.github.com/users/dgsan/repos","events_url":"https://api.github.com/users/dgsan/events{/privacy}","received_events_url":"https://api.github.com/users/dgsan/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rails/rails/labels/activerecord","name":"activerecord","color":"0b02e1"},{"url":"https://api.github.com/repos/rails/rails/labels/enum","name":"enum","color":"d4c5f9"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":18,"created_at":"2014-11-05T00:18:40Z","updated_at":"2015-10-28T22:07:20Z","closed_at":"2015-06-12T13:02:24Z","body":"It's currently not possible to have enums with the same values on different columns in the same model.\r\n\r\nA crude example might be a `Book` with `author_visibility` and `illustrator_visibility` columns for which you'd like to use the same `public`/`private` values on both columns.\r\n\r\nIt'd require changing the current enum API some.\r\nProbably you'd have to do `book.author_visibility.private!` rather than `book.private!`.\r\n\r\nI feel like that kind of approach might be nicer as it could potentially allow enum reuse between models, too. Maybe syntax like:\r\n```\r\nenum VisibilityEnum :illustrator_visibility\r\n```\r\nwhere VisibilityEnum is an object with the enum mapping and the symbol is the column name.\r\n\r\nAnyway, I'm probably going to work around the issue manually for the moment. (I have 3 columns with the same 12-value 'enum,' none can be `null`, and can't decompose since they're essentially treated as a 3-tupple coordinate.)\r\n\r\nMy use case may be atypical, too, but thought I'd bring it up."},"comment":{"url":"https://api.github.com/repos/rails/rails/issues/comments/152012736","html_url":"https://github.com/rails/rails/issues/17511#issuecomment-152012736","issue_url":"https://api.github.com/repos/rails/rails/issues/17511","id":152012736,"user":{"login":"igas","id":175652,"avatar_url":"https://avatars.githubusercontent.com/u/175652?v=3","gravatar_id":"","url":"https://api.github.com/users/igas","html_url":"https://github.com/igas","followers_url":"https://api.github.com/users/igas/followers","following_url":"https://api.github.com/users/igas/following{/other_user}","gists_url":"https://api.github.com/users/igas/gists{/gist_id}","starred_url":"https://api.github.com/users/igas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/igas/subscriptions","organizations_url":"https://api.github.com/users/igas/orgs","repos_url":"https://api.github.com/users/igas/repos","events_url":"https://api.github.com/users/igas/events{/privacy}","received_events_url":"https://api.github.com/users/igas/received_events","type":"User","site_admin":false},"created_at":"2015-10-28T22:07:20Z","updated_at":"2015-10-28T22:07:20Z","body":"@gollawil take a look at #19813"}}