{"action":"created","issue":{"url":"https://api.github.com/repos/lwe/simple_enum/issues/117","labels_url":"https://api.github.com/repos/lwe/simple_enum/issues/117/labels{/name}","comments_url":"https://api.github.com/repos/lwe/simple_enum/issues/117/comments","events_url":"https://api.github.com/repos/lwe/simple_enum/issues/117/events","html_url":"https://github.com/lwe/simple_enum/issues/117","id":110170846,"number":117,"title":"Get value with the enum key","user":{"login":"martinezcoder","id":2434997,"avatar_url":"https://avatars.githubusercontent.com/u/2434997?v=3","gravatar_id":"","url":"https://api.github.com/users/martinezcoder","html_url":"https://github.com/martinezcoder","followers_url":"https://api.github.com/users/martinezcoder/followers","following_url":"https://api.github.com/users/martinezcoder/following{/other_user}","gists_url":"https://api.github.com/users/martinezcoder/gists{/gist_id}","starred_url":"https://api.github.com/users/martinezcoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martinezcoder/subscriptions","organizations_url":"https://api.github.com/users/martinezcoder/orgs","repos_url":"https://api.github.com/users/martinezcoder/repos","events_url":"https://api.github.com/users/martinezcoder/events{/privacy}","received_events_url":"https://api.github.com/users/martinezcoder/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-10-07T08:01:59Z","updated_at":"2015-10-09T15:12:11Z","closed_at":null,"body":"In previous versions of simple_enum (e.g. v1.6.9), when I had some code like this:\r\n\r\n````\r\nclass MyEntry\r\n  include Mongoid::Document\r\n  include SimpleEnum::Mongoid\r\n\r\n  as_enum :status, %i{unresolved resolved}, prefix: true\r\n````\r\n\r\nIt was possible to execute this kind of code:\r\n\r\n````\r\nif @my_entry.status == MyEntry.status_resolved \r\n````\r\n\r\nIn newer versions ( => v2.0.0 ) this code raises an error\r\n\r\n````\r\nNoMethodError: undefined method `status_resolved' for MyEntry:Class\r\n````\r\n\r\nIt was very useful to have this class methods to avoid the programmer to have typo errors. \r\n\r\nIn the version notes it says that now we must use MyEntry.statuses[:resolved], but this won't avoid typo errors of this kind:\r\n\r\n`````\r\nif @my_entry.status == MyEntry.statuses[:resolve]\r\n`````\r\n\r\nNote that I have introduced a type error (resolve instead of resolved) but the code won't raise any error. Also, if some day I change this status name, it will be very dangerous to repair all the code. With last version was easier, because after changing the name I will get a raise error in every mistake.\r\n\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/lwe/simple_enum/issues/comments/146899238","html_url":"https://github.com/lwe/simple_enum/issues/117#issuecomment-146899238","issue_url":"https://api.github.com/repos/lwe/simple_enum/issues/117","id":146899238,"user":{"login":"martinezcoder","id":2434997,"avatar_url":"https://avatars.githubusercontent.com/u/2434997?v=3","gravatar_id":"","url":"https://api.github.com/users/martinezcoder","html_url":"https://github.com/martinezcoder","followers_url":"https://api.github.com/users/martinezcoder/followers","following_url":"https://api.github.com/users/martinezcoder/following{/other_user}","gists_url":"https://api.github.com/users/martinezcoder/gists{/gist_id}","starred_url":"https://api.github.com/users/martinezcoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martinezcoder/subscriptions","organizations_url":"https://api.github.com/users/martinezcoder/orgs","repos_url":"https://api.github.com/users/martinezcoder/repos","events_url":"https://api.github.com/users/martinezcoder/events{/privacy}","received_events_url":"https://api.github.com/users/martinezcoder/received_events","type":"User","site_admin":false},"created_at":"2015-10-09T15:12:11Z","updated_at":"2015-10-09T15:12:11Z","body":"yes, thanks!"}}