GitHub PullRequestReviewCommentEvent at 2014-12-04 20:22:37
Repository: activerecord-typedstore
Actor: byroot
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/byroot/activerecord-typedstore/pulls/comments/21333003","id":21333003,"diff_hunk":"@@ -46,9 +47,37 @@ def type_cast(value, map=true)\n         return super(value.iso8601)\n       end\n \n-      super(value)\n+      defined?(super) ? super(value) : type_cast_from_database(value)\n     end\n \n   end\n \n+  if defined? ::ActiveRecord::Type\n+    BaseColumn = remove_const(:Column)\n+\n+    class DecimalType < ::ActiveRecord::Type::Decimal\n+      def type_cast_from_database(value)\n+        value = value.to_s if value.is_a?(Float)\n+        super(value)\n+      end\n+    end\n+\n+    class Column < BaseColumn\n+      CAST_TYPES = {\n+        boolean: ::ActiveRecord::Type::Boolean,\n+        integer: ::ActiveRecord::Type::Integer,\n+        string: ::ActiveRecord::Type::String,\n+        float: ::ActiveRecord::Type::Float,\n+        date: ::ActiveRecord::Type::Date,\n+        datetime: ::ActiveRecord::Type::DateTime,\n+        decimal: DecimalType,\n+        any: ::ActiveRecord::Type::Value,\n+      }\n+\n+      def initialize(_, type, *)\n+        @cast_type = CAST_TYPES.fetch(type).new\n+        super\n+      end","path":"lib/active_record/typed_store/column.rb","position":45,"original_position":45,"commit_id":"2a3153ae862c8bb31c6362d41d5269c4b0cdfae5","original_commit_id":"2a3153ae862c8bb31c6362d41d5269c4b0cdfae5","user":{"login":"byroot","id":44640,"avatar_url":"https://avatars.githubusercontent.com/u/44640?v=3","gravatar_id":"","url":"https://api.github.com/users/byroot","html_url":"https://github.com/byroot","followers_url":"https://api.github.com/users/byroot/followers","following_url":"https://api.github.com/users/byroot/following{/other_user}","gists_url":"https://api.github.com/users/byroot/gists{/gist_id}","starred_url":"https://api.github.com/users/byroot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/byroot/subscriptions","organizations_url":"https://api.github.com/users/byroot/orgs","repos_url":"https://api.github.com/users/byroot/repos","events_url":"https://api.github.com/users/byroot/events{/privacy}","received_events_url":"https://api.github.com/users/byroot/received_events","type":"User","site_admin":false},"body":"Thanks for the hint. I plan in doing a new major version that target only 4.2+ given how much the internal APIs changed.","created_at":"2014-12-04T20:22:37Z","updated_at":"2014-12-04T20:22:37Z","html_url":"https://github.com/byroot/activerecord-typedstore/pull/21#discussion_r21333003","pull_request_url":"https://api.github.com/repos/byroot/activerecord-typedstore/pulls/21","_links":{"self":{"href":"https://api.github.com/repos/byroot/activerecord-typedstore/pulls/comments/21333003"},"html":{"href":"https://github.com/byroot/activerecord-typedstore/pull/21#discussion_r21333003"},"pull_request":{"href":"https://api.github.com/repos/byroot/activerecord-typedstore/pulls/21"}}},"pull_request":{"url":"https://api.github.com/repos/byroot/activerecord-typedstore/pulls/21","id":25455273,"html_url":"https://github.com/byroot/activerecord-typedstore/pull/21","diff_url":"https://github.com/byroot/activerecord-typedstore/pull/21.diff","patch_url":"https://github.com/byroot/activerecord-typedstore/pull/21.patch","issue_url":"https://api.github.com/repos/byroot/activerecord-typedstore/issues/21","number":21,"state":"open","locked":false,"title":"Rails 4.2.0-rc1 support","user":{"login":"byroot","id":44640,"avatar_url":"https://avatars.githubusercontent.com/u/44640?v=3","gravatar_id":"","url":"https://api.github.com/users/byroot","html_url":"https://github.com/byroot","followers_url":"https://api.github.com/users/byroot/followers","following_url":"https://api.github.com/users/byroot/following{/other_user}","gists_url":"https://api.github.com/users/byroot/gists{/gist_id}","starred_url":"https://api.github.com/users/byroot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/byroot/subscriptions","organizations_url":"https://api.github.com/users/byroot/orgs","repos_url":"https://api.github.com/users/byroot/repos","events_url":"https://api.github.com/users/byroot/events{/privacy}","received_events_url":"https://api.github.com/users/byroot/received_events","type":"User","site_admin":false},"body":"Fixes: https://github.com/byroot/activerecord-typedstore/issues/20\r\n\r\nThings left to do:\r\n  - [ ] Workaround the warning\r\n  - [ ] Blocked by a bug upstream: https://github.com/rails/rails/issues/17900\r\n\r\nOtherwise everything is green.\r\n\r\n\r\n\r\n","created_at":"2014-12-03T21:57:05Z","updated_at":"2014-12-04T20:22:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"82a8bfe96037637789967765968bbc0a8c27d921","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/byroot/activerecord-typedstore/pulls/21/commits","review_comments_url":"https://api.github.com/repos/byroot/activerecord-typedstore/pulls/21/comments","review_comment_url":"https://api.github.com/repos/byroot/activerecord-typedstore/pulls/comments/{number}","comments_url":"https://api.github.com/repos/byroot/activerecord-typedstore/issues/21/comments","statuses_url":"https://api.github.com/repos/byroot/activerecord-typedstore/statuses/2a3153ae862c8bb31c6362d41d5269c4b0cdfae5","head":{"label":"byroot:rails-4-2","ref":"rails-4-2","sha":"2a3153ae862c8bb31c6362d41d5269c4b0cdfae5","user":{"login":"byroot","id":44640,"avatar_url":"https://avatars.githubusercontent.com/u/44640?v=3","gravatar_id":"","url":"https://api.github.com/users/byroot","html_url":"https://github.com/byroot","followers_url":"https://api.github.com/users/byroot/followers","following_url":"https://api.github.com/users/byroot/following{/other_user}","gists_url":"https://api.github.com/users/byroot/gists{/gist_id}","starred_url":"https://api.github.com/users/byroot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/byroot/subscriptions","organizations_url":"https://api.github.com/users/byroot/orgs","repos_url":"https://api.github.com/users/byroot/repos","events_url":"https://api.github.com/users/byroot/events{/privacy}","received_events_url":"https://api.github.com/users/byroot/received_events","type":"User","site_admin":false},"repo":{"id":13891875,"name":"activerecord-typedstore","full_name":"byroot/activerecord-typedstore","owner":{"login":"byroot","id":44640,"avatar_url":"https://avatars.githubusercontent.com/u/44640?v=3","gravatar_id":"","url":"https://api.github.com/users/byroot","html_url":"https://github.com/byroot","followers_url":"https://api.github.com/users/byroot/followers","following_url":"https://api.github.com/users/byroot/following{/other_user}","gists_url":"https://api.github.com/users/byroot/gists{/gist_id}","starred_url":"https://api.github.com/users/byroot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/byroot/subscriptions","organizations_url":"https://api.github.com/users/byroot/orgs","repos_url":"https://api.github.com/users/byroot/repos","events_url":"https://api.github.com/users/byroot/events{/privacy}","received_events_url":"https://api.github.com/users/byroot/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/byroot/activerecord-typedstore","description":"ActiveRecord::Store but with type definition","fork":false,"url":"https://api.github.com/repos/byroot/activerecord-typedstore","forks_url":"https://api.github.com/repos/byroot/activerecord-typedstore/forks","keys_url":"https://api.github.com/repos/byroot/activerecord-typedstore/keys{/key_id}","collaborators_url":"https://api.github.com/repos/byroot/activerecord-typedstore/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/byroot/activerecord-typedstore/teams","hooks_url":"https://api.github.com/repos/byroot/activerecord-typedstore/hooks","issue_events_url":"https://api.github.com/repos/byroot/activerecord-typedstore/issues/events{/number}","events_url":"https://api.github.com/repos/byroot/activerecord-typedstore/events","assignees_url":"https://api.github.com/repos/byroot/activerecord-typedstore/assignees{/user}","branches_url":"https://api.github.com/repos/byroot/activerecord-typedstore/branches{/branch}","tags_url":"https://api.github.com/repos/byroot/activerecord-typedstore/tags","blobs_url":"https://api.github.com/repos/byroot/activerecord-typedstore/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/byroot/activerecord-typedstore/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/byroot/activerecord-typedstore/git/refs{/sha}","trees_url":"https://api.github.com/repos/byroot/activerecord-typedstore/git/trees{/sha}","statuses_url":"https://api.github.com/repos/byroot/activerecord-typedstore/statuses/{sha}","languages_url":"https://api.github.com/repos/byroot/activerecord-typedstore/languages","stargazers_url":"https://api.github.com/repos/byroot/activerecord-typedstore/stargazers","contributors_url":"https://api.github.com/repos/byroot/activerecord-typedstore/contributors","subscribers_url":"https://api.github.com/repos/byroot/activerecord-typedstore/subscribers","subscription_url":"https://api.github.com/repos/byroot/activerecord-typedstore/subscription","commits_url":"https://api.github.com/repos/byroot/activerecord-typedstore/commits{/sha}","git_commits_url":"https://api.github.com/repos/byroot/activerecord-typedstore/git/commits{/sha}","comments_url":"https://api.github.com/repos/byroot/activerecord-typedstore/comments{/number}","issue_comment_url":"https://api.github.com/repos/byroot/activerecord-typedstore/issues/comments/{number}","contents_url":"https://api.github.com/repos/byroot/activerecord-typedstore/contents/{+path}","compare_url":"https://api.github.com/repos/byroot/activerecord-typedstore/compare/{base}...{head}","merges_url":"https://api.github.com/repos/byroot/activerecord-typedstore/merges","archive_url":"https://api.github.com/repos/byroot/activerecord-typedstore/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/byroot/activerecord-typedstore/downloads","issues_url":"https://api.github.com/repos/byroot/activerecord-typedstore/issues{/number}","pulls_url":"https://api.github.com/repos/byroot/activerecord-typedstore/pulls{/number}","milestones_url":"https://api.github.com/repos/byroot/activerecord-typedstore/milestones{/number}","notifications_url":"https://api.github.com/repos/byroot/activerecord-typedstore/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/byroot/activerecord-typedstore/labels{/name}","releases_url":"https://api.github.com/repos/byroot/activerecord-typedstore/releases{/id}","created_at":"2013-10-26T22:04:54Z","updated_at":"2014-10-18T11:44:42Z","pushed_at":"2014-12-03T23:41:17Z","git_url":"git://github.com/byroot/activerecord-typedstore.git","ssh_url":"git@github.com:byroot/activerecord-typedstore.git","clone_url":"https://github.com/byroot/activerecord-typedstore.git","svn_url":"https://github.com/byroot/activerecord-typedstore","homepage":null,"size":707,"stargazers_count":45,"watchers_count":45,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":5,"forks":4,"open_issues":5,"watchers":45,"default_branch":"master"}},"base":{"label":"byroot:master","ref":"master","sha":"47d330a9f95a35c36a053d4fffba8533203d90ac","user":{"login":"byroot","id":44640,"avatar_url":"https://avatars.githubusercontent.com/u/44640?v=3","gravatar_id":"","url":"https://api.github.com/users/byroot","html_url":"https://github.com/byroot","followers_url":"https://api.github.com/users/byroot/followers","following_url":"https://api.github.com/users/byroot/following{/other_user}","gists_url":"https://api.github.com/users/byroot/gists{/gist_id}","starred_url":"https://api.github.com/users/byroot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/byroot/subscriptions","organizations_url":"https://api.github.com/users/byroot/orgs","repos_url":"https://api.github.com/users/byroot/repos","events_url":"https://api.github.com/users/byroot/events{/privacy}","received_events_url":"https://api.github.com/users/byroot/received_events","type":"User","site_admin":false},"repo":{"id":13891875,"name":"activerecord-typedstore","full_name":"byroot/activerecord-typedstore","owner":{"login":"byroot","id":44640,"avatar_url":"https://avatars.githubusercontent.com/u/44640?v=3","gravatar_id":"","url":"https://api.github.com/users/byroot","html_url":"https://github.com/byroot","followers_url":"https://api.github.com/users/byroot/followers","following_url":"https://api.github.com/users/byroot/following{/other_user}","gists_url":"https://api.github.com/users/byroot/gists{/gist_id}","starred_url":"https://api.github.com/users/byroot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/byroot/subscriptions","organizations_url":"https://api.github.com/users/byroot/orgs","repos_url":"https://api.github.com/users/byroot/repos","events_url":"https://api.github.com/users/byroot/events{/privacy}","received_events_url":"https://api.github.com/users/byroot/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/byroot/activerecord-typedstore","description":"ActiveRecord::Store but with type definition","fork":false,"url":"https://api.github.com/repos/byroot/activerecord-typedstore","forks_url":"https://api.github.com/repos/byroot/activerecord-typedstore/forks","keys_url":"https://api.github.com/repos/byroot/activerecord-typedstore/keys{/key_id}","collaborators_url":"https://api.github.com/repos/byroot/activerecord-typedstore/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/byroot/activerecord-typedstore/teams","hooks_url":"https://api.github.com/repos/byroot/activerecord-typedstore/hooks","issue_events_url":"https://api.github.com/repos/byroot/activerecord-typedstore/issues/events{/number}","events_url":"https://api.github.com/repos/byroot/activerecord-typedstore/events","assignees_url":"https://api.github.com/repos/byroot/activerecord-typedstore/assignees{/user}","branches_url":"https://api.github.com/repos/byroot/activerecord-typedstore/branches{/branch}","tags_url":"https://api.github.com/repos/byroot/activerecord-typedstore/tags","blobs_url":"https://api.github.com/repos/byroot/activerecord-typedstore/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/byroot/activerecord-typedstore/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/byroot/activerecord-typedstore/git/refs{/sha}","trees_url":"https://api.github.com/repos/byroot/activerecord-typedstore/git/trees{/sha}","statuses_url":"https://api.github.com/repos/byroot/activerecord-typedstore/statuses/{sha}","languages_url":"https://api.github.com/repos/byroot/activerecord-typedstore/languages","stargazers_url":"https://api.github.com/repos/byroot/activerecord-typedstore/stargazers","contributors_url":"https://api.github.com/repos/byroot/activerecord-typedstore/contributors","subscribers_url":"https://api.github.com/repos/byroot/activerecord-typedstore/subscribers","subscription_url":"https://api.github.com/repos/byroot/activerecord-typedstore/subscription","commits_url":"https://api.github.com/repos/byroot/activerecord-typedstore/commits{/sha}","git_commits_url":"https://api.github.com/repos/byroot/activerecord-typedstore/git/commits{/sha}","comments_url":"https://api.github.com/repos/byroot/activerecord-typedstore/comments{/number}","issue_comment_url":"https://api.github.com/repos/byroot/activerecord-typedstore/issues/comments/{number}","contents_url":"https://api.github.com/repos/byroot/activerecord-typedstore/contents/{+path}","compare_url":"https://api.github.com/repos/byroot/activerecord-typedstore/compare/{base}...{head}","merges_url":"https://api.github.com/repos/byroot/activerecord-typedstore/merges","archive_url":"https://api.github.com/repos/byroot/activerecord-typedstore/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/byroot/activerecord-typedstore/downloads","issues_url":"https://api.github.com/repos/byroot/activerecord-typedstore/issues{/number}","pulls_url":"https://api.github.com/repos/byroot/activerecord-typedstore/pulls{/number}","milestones_url":"https://api.github.com/repos/byroot/activerecord-typedstore/milestones{/number}","notifications_url":"https://api.github.com/repos/byroot/activerecord-typedstore/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/byroot/activerecord-typedstore/labels{/name}","releases_url":"https://api.github.com/repos/byroot/activerecord-typedstore/releases{/id}","created_at":"2013-10-26T22:04:54Z","updated_at":"2014-10-18T11:44:42Z","pushed_at":"2014-12-03T23:41:17Z","git_url":"git://github.com/byroot/activerecord-typedstore.git","ssh_url":"git@github.com:byroot/activerecord-typedstore.git","clone_url":"https://github.com/byroot/activerecord-typedstore.git","svn_url":"https://github.com/byroot/activerecord-typedstore","homepage":null,"size":707,"stargazers_count":45,"watchers_count":45,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":5,"forks":4,"open_issues":5,"watchers":45,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/byroot/activerecord-typedstore/pulls/21"},"html":{"href":"https://github.com/byroot/activerecord-typedstore/pull/21"},"issue":{"href":"https://api.github.com/repos/byroot/activerecord-typedstore/issues/21"},"comments":{"href":"https://api.github.com/repos/byroot/activerecord-typedstore/issues/21/comments"},"review_comments":{"href":"https://api.github.com/repos/byroot/activerecord-typedstore/pulls/21/comments"},"review_comment":{"href":"https://api.github.com/repos/byroot/activerecord-typedstore/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/byroot/activerecord-typedstore/pulls/21/commits"},"statuses":{"href":"https://api.github.com/repos/byroot/activerecord-typedstore/statuses/2a3153ae862c8bb31c6362d41d5269c4b0cdfae5"}}}}