{"action":"created","comment":{"url":"https://api.github.com/repos/brianclio/rails_column_enumerator/pulls/comments/51498115","id":51498115,"diff_hunk":"@@ -13,11 +21,20 @@ def enumerated_column(column_name, enumerated_values, options = {})\n     end\n \n     self.send(:define_method, column_name.to_s + '=') do |val|\n-      if val.is_a?(String) || val.is_a?(Symbol)\n-        val = val.to_s.downcase\n-        write_attribute(column_name, self.class.const_get(enum_name)[val])\n-      else\n-        write_attribute(column_name, val)\n+      write_attribute(column_name, RailsColumnEnumerator.get_int(val, self.class.const_get(enum_name), self.class.const_get(enum_symbols_name)))\n+    end\n+\n+    enumerator_associations = options.delete(:scopes)\n+    if enumerator_associations\n+      enumerator_associations.each do |key,values|\n+        found_values = values.map { |val| RailsColumnEnumerator.get_int(val, self.const_get(enum_name), self.const_get(enum_symbols_name)) }","path":"lib/rails_column_enumerator.rb","position":30,"original_position":30,"commit_id":"24c09e7ec7d438c1ea3093c2024261009790ef4a","original_commit_id":"c39997c991b4fb1d65e713604078aee06cbfadcb","user":{"login":"michaelcheung","id":60846,"avatar_url":"https://avatars.githubusercontent.com/u/60846?v=3","gravatar_id":"","url":"https://api.github.com/users/michaelcheung","html_url":"https://github.com/michaelcheung","followers_url":"https://api.github.com/users/michaelcheung/followers","following_url":"https://api.github.com/users/michaelcheung/following{/other_user}","gists_url":"https://api.github.com/users/michaelcheung/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelcheung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelcheung/subscriptions","organizations_url":"https://api.github.com/users/michaelcheung/orgs","repos_url":"https://api.github.com/users/michaelcheung/repos","events_url":"https://api.github.com/users/michaelcheung/events{/privacy}","received_events_url":"https://api.github.com/users/michaelcheung/received_events","type":"User","site_admin":false},"body":"Yep, you're right. Please ignore.","created_at":"2016-02-01T23:20:05Z","updated_at":"2016-02-01T23:20:05Z","html_url":"https://github.com/brianclio/rails_column_enumerator/pull/2#discussion_r51498115","pull_request_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/brianclio/rails_column_enumerator/pulls/comments/51498115"},"html":{"href":"https://github.com/brianclio/rails_column_enumerator/pull/2#discussion_r51498115"},"pull_request":{"href":"https://api.github.com/repos/brianclio/rails_column_enumerator/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/brianclio/rails_column_enumerator/pulls/2","id":57879868,"html_url":"https://github.com/brianclio/rails_column_enumerator/pull/2","diff_url":"https://github.com/brianclio/rails_column_enumerator/pull/2.diff","patch_url":"https://github.com/brianclio/rails_column_enumerator/pull/2.patch","issue_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/issues/2","number":2,"state":"open","locked":false,"title":"Add scopes","user":{"login":"brianclio","id":9439226,"avatar_url":"https://avatars.githubusercontent.com/u/9439226?v=3","gravatar_id":"","url":"https://api.github.com/users/brianclio","html_url":"https://github.com/brianclio","followers_url":"https://api.github.com/users/brianclio/followers","following_url":"https://api.github.com/users/brianclio/following{/other_user}","gists_url":"https://api.github.com/users/brianclio/gists{/gist_id}","starred_url":"https://api.github.com/users/brianclio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brianclio/subscriptions","organizations_url":"https://api.github.com/users/brianclio/orgs","repos_url":"https://api.github.com/users/brianclio/repos","events_url":"https://api.github.com/users/brianclio/events{/privacy}","received_events_url":"https://api.github.com/users/brianclio/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-02-01T18:30:44Z","updated_at":"2016-02-01T23:20:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8408c5919ac1eeecd415262445130f576f239714","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/pulls/2/commits","review_comments_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/pulls/2/comments","review_comment_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/pulls/comments{/number}","comments_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/issues/2/comments","statuses_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/statuses/24c09e7ec7d438c1ea3093c2024261009790ef4a","head":{"label":"brianclio:add-scopes","ref":"add-scopes","sha":"24c09e7ec7d438c1ea3093c2024261009790ef4a","user":{"login":"brianclio","id":9439226,"avatar_url":"https://avatars.githubusercontent.com/u/9439226?v=3","gravatar_id":"","url":"https://api.github.com/users/brianclio","html_url":"https://github.com/brianclio","followers_url":"https://api.github.com/users/brianclio/followers","following_url":"https://api.github.com/users/brianclio/following{/other_user}","gists_url":"https://api.github.com/users/brianclio/gists{/gist_id}","starred_url":"https://api.github.com/users/brianclio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brianclio/subscriptions","organizations_url":"https://api.github.com/users/brianclio/orgs","repos_url":"https://api.github.com/users/brianclio/repos","events_url":"https://api.github.com/users/brianclio/events{/privacy}","received_events_url":"https://api.github.com/users/brianclio/received_events","type":"User","site_admin":false},"repo":{"id":46382461,"name":"rails_column_enumerator","full_name":"brianclio/rails_column_enumerator","owner":{"login":"brianclio","id":9439226,"avatar_url":"https://avatars.githubusercontent.com/u/9439226?v=3","gravatar_id":"","url":"https://api.github.com/users/brianclio","html_url":"https://github.com/brianclio","followers_url":"https://api.github.com/users/brianclio/followers","following_url":"https://api.github.com/users/brianclio/following{/other_user}","gists_url":"https://api.github.com/users/brianclio/gists{/gist_id}","starred_url":"https://api.github.com/users/brianclio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brianclio/subscriptions","organizations_url":"https://api.github.com/users/brianclio/orgs","repos_url":"https://api.github.com/users/brianclio/repos","events_url":"https://api.github.com/users/brianclio/events{/privacy}","received_events_url":"https://api.github.com/users/brianclio/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/brianclio/rails_column_enumerator","description":"Simple attribute enumerator for ActiveRecord models in Rails","fork":false,"url":"https://api.github.com/repos/brianclio/rails_column_enumerator","forks_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/forks","keys_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/teams","hooks_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/hooks","issue_events_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/issues/events{/number}","events_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/events","assignees_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/assignees{/user}","branches_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/branches{/branch}","tags_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/tags","blobs_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/git/refs{/sha}","trees_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/statuses/{sha}","languages_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/languages","stargazers_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/stargazers","contributors_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/contributors","subscribers_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/subscribers","subscription_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/subscription","commits_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/commits{/sha}","git_commits_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/git/commits{/sha}","comments_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/comments{/number}","issue_comment_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/issues/comments{/number}","contents_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/contents/{+path}","compare_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/merges","archive_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/downloads","issues_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/issues{/number}","pulls_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/pulls{/number}","milestones_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/milestones{/number}","notifications_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/labels{/name}","releases_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/releases{/id}","deployments_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/deployments","created_at":"2015-11-17T23:36:05Z","updated_at":"2016-02-01T18:26:27Z","pushed_at":"2016-02-01T23:06:30Z","git_url":"git://github.com/brianclio/rails_column_enumerator.git","ssh_url":"git@github.com:brianclio/rails_column_enumerator.git","clone_url":"https://github.com/brianclio/rails_column_enumerator.git","svn_url":"https://github.com/brianclio/rails_column_enumerator","homepage":"","size":30,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"brianclio:master","ref":"master","sha":"a437907e4f3e252eb96ccaee302cfd99f6735789","user":{"login":"brianclio","id":9439226,"avatar_url":"https://avatars.githubusercontent.com/u/9439226?v=3","gravatar_id":"","url":"https://api.github.com/users/brianclio","html_url":"https://github.com/brianclio","followers_url":"https://api.github.com/users/brianclio/followers","following_url":"https://api.github.com/users/brianclio/following{/other_user}","gists_url":"https://api.github.com/users/brianclio/gists{/gist_id}","starred_url":"https://api.github.com/users/brianclio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brianclio/subscriptions","organizations_url":"https://api.github.com/users/brianclio/orgs","repos_url":"https://api.github.com/users/brianclio/repos","events_url":"https://api.github.com/users/brianclio/events{/privacy}","received_events_url":"https://api.github.com/users/brianclio/received_events","type":"User","site_admin":false},"repo":{"id":46382461,"name":"rails_column_enumerator","full_name":"brianclio/rails_column_enumerator","owner":{"login":"brianclio","id":9439226,"avatar_url":"https://avatars.githubusercontent.com/u/9439226?v=3","gravatar_id":"","url":"https://api.github.com/users/brianclio","html_url":"https://github.com/brianclio","followers_url":"https://api.github.com/users/brianclio/followers","following_url":"https://api.github.com/users/brianclio/following{/other_user}","gists_url":"https://api.github.com/users/brianclio/gists{/gist_id}","starred_url":"https://api.github.com/users/brianclio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brianclio/subscriptions","organizations_url":"https://api.github.com/users/brianclio/orgs","repos_url":"https://api.github.com/users/brianclio/repos","events_url":"https://api.github.com/users/brianclio/events{/privacy}","received_events_url":"https://api.github.com/users/brianclio/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/brianclio/rails_column_enumerator","description":"Simple attribute enumerator for ActiveRecord models in Rails","fork":false,"url":"https://api.github.com/repos/brianclio/rails_column_enumerator","forks_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/forks","keys_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/teams","hooks_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/hooks","issue_events_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/issues/events{/number}","events_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/events","assignees_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/assignees{/user}","branches_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/branches{/branch}","tags_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/tags","blobs_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/git/refs{/sha}","trees_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/statuses/{sha}","languages_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/languages","stargazers_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/stargazers","contributors_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/contributors","subscribers_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/subscribers","subscription_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/subscription","commits_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/commits{/sha}","git_commits_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/git/commits{/sha}","comments_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/comments{/number}","issue_comment_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/issues/comments{/number}","contents_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/contents/{+path}","compare_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/merges","archive_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/downloads","issues_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/issues{/number}","pulls_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/pulls{/number}","milestones_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/milestones{/number}","notifications_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/labels{/name}","releases_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/releases{/id}","deployments_url":"https://api.github.com/repos/brianclio/rails_column_enumerator/deployments","created_at":"2015-11-17T23:36:05Z","updated_at":"2016-02-01T18:26:27Z","pushed_at":"2016-02-01T23:06:30Z","git_url":"git://github.com/brianclio/rails_column_enumerator.git","ssh_url":"git@github.com:brianclio/rails_column_enumerator.git","clone_url":"https://github.com/brianclio/rails_column_enumerator.git","svn_url":"https://github.com/brianclio/rails_column_enumerator","homepage":"","size":30,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/brianclio/rails_column_enumerator/pulls/2"},"html":{"href":"https://github.com/brianclio/rails_column_enumerator/pull/2"},"issue":{"href":"https://api.github.com/repos/brianclio/rails_column_enumerator/issues/2"},"comments":{"href":"https://api.github.com/repos/brianclio/rails_column_enumerator/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/brianclio/rails_column_enumerator/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/brianclio/rails_column_enumerator/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/brianclio/rails_column_enumerator/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/brianclio/rails_column_enumerator/statuses/24c09e7ec7d438c1ea3093c2024261009790ef4a"}}}}