{"action":"created","comment":{"url":"https://api.github.com/repos/Shopify/measured-rails/pulls/comments/88913471","pull_request_review_id":9470300,"id":88913471,"diff_hunk":"@@ -43,6 +43,15 @@ class Thing < ActiveRecord::Base\n end\n ```\n \n+You can optionally customize the model's unit accessor column by specifying it in the `unit_column_name` option, as follows:\n+\n+```ruby\n+class ThingWithCustomUnitAccessor < ActiveRecord::Base\n+  measured_length :length, :width, height,      unit_column_name: :size_unit","path":"README.md","position":17,"original_position":17,"commit_id":"5e31de1ad179043d549c67b8b88c2145f99b1924","original_commit_id":"5e31de1ad179043d549c67b8b88c2145f99b1924","user":{"login":"Goldenson","id":6765108,"avatar_url":"https://avatars.githubusercontent.com/u/6765108?v=3","gravatar_id":"","url":"https://api.github.com/users/Goldenson","html_url":"https://github.com/Goldenson","followers_url":"https://api.github.com/users/Goldenson/followers","following_url":"https://api.github.com/users/Goldenson/following{/other_user}","gists_url":"https://api.github.com/users/Goldenson/gists{/gist_id}","starred_url":"https://api.github.com/users/Goldenson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Goldenson/subscriptions","organizations_url":"https://api.github.com/users/Goldenson/orgs","repos_url":"https://api.github.com/users/Goldenson/repos","events_url":"https://api.github.com/users/Goldenson/events{/privacy}","received_events_url":"https://api.github.com/users/Goldenson/received_events","type":"User","site_admin":false},"body":"Shouldn't this `height` be symbolized ?","created_at":"2016-11-21T15:11:10Z","updated_at":"2016-11-21T15:11:10Z","html_url":"https://github.com/Shopify/measured-rails/pull/27#discussion_r88913471","pull_request_url":"https://api.github.com/repos/Shopify/measured-rails/pulls/27","_links":{"self":{"href":"https://api.github.com/repos/Shopify/measured-rails/pulls/comments/88913471"},"html":{"href":"https://github.com/Shopify/measured-rails/pull/27#discussion_r88913471"},"pull_request":{"href":"https://api.github.com/repos/Shopify/measured-rails/pulls/27"}}},"pull_request":{"url":"https://api.github.com/repos/Shopify/measured-rails/pulls/27","id":94442242,"html_url":"https://github.com/Shopify/measured-rails/pull/27","diff_url":"https://github.com/Shopify/measured-rails/pull/27.diff","patch_url":"https://github.com/Shopify/measured-rails/pull/27.patch","issue_url":"https://api.github.com/repos/Shopify/measured-rails/issues/27","number":27,"state":"open","locked":false,"title":"Add support for customizing the column holding the measured unit","user":{"login":"benwah","id":165929,"avatar_url":"https://avatars.githubusercontent.com/u/165929?v=3","gravatar_id":"","url":"https://api.github.com/users/benwah","html_url":"https://github.com/benwah","followers_url":"https://api.github.com/users/benwah/followers","following_url":"https://api.github.com/users/benwah/following{/other_user}","gists_url":"https://api.github.com/users/benwah/gists{/gist_id}","starred_url":"https://api.github.com/users/benwah/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benwah/subscriptions","organizations_url":"https://api.github.com/users/benwah/orgs","repos_url":"https://api.github.com/users/benwah/repos","events_url":"https://api.github.com/users/benwah/events{/privacy}","received_events_url":"https://api.github.com/users/benwah/received_events","type":"User","site_admin":false},"body":"**Problem**\r\n\r\nWith the current implementation of measured-rails, we need a separate column to hold the units of each declared field. Sometimes you might want to just use the same column to hold these units, but this is not possible.\r\n\r\n**Solution**\r\n\r\nI'm suggesting that we add an option when declaring `measured_length` and `measured_weight`: `unit_column_name`. This tells measured-rails which field it should read the unit from.\r\n\r\n**Sample usage**\r\n\r\n```ruby\r\nclass ThingWithCustomUnitAccessor < ActiveRecord::Base\r\n  measured_length :length, :width, height,      unit_column_name: :size_unit\r\n  measured_weight :total_weight, :extra_weight, unit_column_name: :weight_unit\r\nend\r\n```\r\n\r\nCR: @kmcphillips @MalazAlamir ","created_at":"2016-11-18T21:44:23Z","updated_at":"2016-11-21T15:23:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ab92c79a3a837930b2702a9c4a46eb87c170ff03","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Shopify/measured-rails/pulls/27/commits","review_comments_url":"https://api.github.com/repos/Shopify/measured-rails/pulls/27/comments","review_comment_url":"https://api.github.com/repos/Shopify/measured-rails/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Shopify/measured-rails/issues/27/comments","statuses_url":"https://api.github.com/repos/Shopify/measured-rails/statuses/5e31de1ad179043d549c67b8b88c2145f99b1924","head":{"label":"Shopify:add_support_for_specifying_column_used_to_hold_measured_unit","ref":"add_support_for_specifying_column_used_to_hold_measured_unit","sha":"5e31de1ad179043d549c67b8b88c2145f99b1924","user":{"login":"Shopify","id":8085,"avatar_url":"https://avatars.githubusercontent.com/u/8085?v=3","gravatar_id":"","url":"https://api.github.com/users/Shopify","html_url":"https://github.com/Shopify","followers_url":"https://api.github.com/users/Shopify/followers","following_url":"https://api.github.com/users/Shopify/following{/other_user}","gists_url":"https://api.github.com/users/Shopify/gists{/gist_id}","starred_url":"https://api.github.com/users/Shopify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shopify/subscriptions","organizations_url":"https://api.github.com/users/Shopify/orgs","repos_url":"https://api.github.com/users/Shopify/repos","events_url":"https://api.github.com/users/Shopify/events{/privacy}","received_events_url":"https://api.github.com/users/Shopify/received_events","type":"Organization","site_admin":false},"repo":{"id":31735519,"name":"measured-rails","full_name":"Shopify/measured-rails","owner":{"login":"Shopify","id":8085,"avatar_url":"https://avatars.githubusercontent.com/u/8085?v=3","gravatar_id":"","url":"https://api.github.com/users/Shopify","html_url":"https://github.com/Shopify","followers_url":"https://api.github.com/users/Shopify/followers","following_url":"https://api.github.com/users/Shopify/following{/other_user}","gists_url":"https://api.github.com/users/Shopify/gists{/gist_id}","starred_url":"https://api.github.com/users/Shopify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shopify/subscriptions","organizations_url":"https://api.github.com/users/Shopify/orgs","repos_url":"https://api.github.com/users/Shopify/repos","events_url":"https://api.github.com/users/Shopify/events{/privacy}","received_events_url":"https://api.github.com/users/Shopify/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Shopify/measured-rails","description":"Rails adapter for the measured gem. Encapsulate measurements and their units in Ruby and Rails.","fork":false,"url":"https://api.github.com/repos/Shopify/measured-rails","forks_url":"https://api.github.com/repos/Shopify/measured-rails/forks","keys_url":"https://api.github.com/repos/Shopify/measured-rails/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Shopify/measured-rails/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Shopify/measured-rails/teams","hooks_url":"https://api.github.com/repos/Shopify/measured-rails/hooks","issue_events_url":"https://api.github.com/repos/Shopify/measured-rails/issues/events{/number}","events_url":"https://api.github.com/repos/Shopify/measured-rails/events","assignees_url":"https://api.github.com/repos/Shopify/measured-rails/assignees{/user}","branches_url":"https://api.github.com/repos/Shopify/measured-rails/branches{/branch}","tags_url":"https://api.github.com/repos/Shopify/measured-rails/tags","blobs_url":"https://api.github.com/repos/Shopify/measured-rails/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Shopify/measured-rails/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Shopify/measured-rails/git/refs{/sha}","trees_url":"https://api.github.com/repos/Shopify/measured-rails/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Shopify/measured-rails/statuses/{sha}","languages_url":"https://api.github.com/repos/Shopify/measured-rails/languages","stargazers_url":"https://api.github.com/repos/Shopify/measured-rails/stargazers","contributors_url":"https://api.github.com/repos/Shopify/measured-rails/contributors","subscribers_url":"https://api.github.com/repos/Shopify/measured-rails/subscribers","subscription_url":"https://api.github.com/repos/Shopify/measured-rails/subscription","commits_url":"https://api.github.com/repos/Shopify/measured-rails/commits{/sha}","git_commits_url":"https://api.github.com/repos/Shopify/measured-rails/git/commits{/sha}","comments_url":"https://api.github.com/repos/Shopify/measured-rails/comments{/number}","issue_comment_url":"https://api.github.com/repos/Shopify/measured-rails/issues/comments{/number}","contents_url":"https://api.github.com/repos/Shopify/measured-rails/contents/{+path}","compare_url":"https://api.github.com/repos/Shopify/measured-rails/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Shopify/measured-rails/merges","archive_url":"https://api.github.com/repos/Shopify/measured-rails/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Shopify/measured-rails/downloads","issues_url":"https://api.github.com/repos/Shopify/measured-rails/issues{/number}","pulls_url":"https://api.github.com/repos/Shopify/measured-rails/pulls{/number}","milestones_url":"https://api.github.com/repos/Shopify/measured-rails/milestones{/number}","notifications_url":"https://api.github.com/repos/Shopify/measured-rails/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Shopify/measured-rails/labels{/name}","releases_url":"https://api.github.com/repos/Shopify/measured-rails/releases{/id}","deployments_url":"https://api.github.com/repos/Shopify/measured-rails/deployments","created_at":"2015-03-05T20:48:38Z","updated_at":"2016-11-18T16:14:13Z","pushed_at":"2016-11-18T23:06:35Z","git_url":"git://github.com/Shopify/measured-rails.git","ssh_url":"git@github.com:Shopify/measured-rails.git","clone_url":"https://github.com/Shopify/measured-rails.git","svn_url":"https://github.com/Shopify/measured-rails","homepage":"","size":77,"stargazers_count":17,"watchers_count":17,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":17,"default_branch":"master"}},"base":{"label":"Shopify:master","ref":"master","sha":"ed32f82122c38a1fe1d35b1cfaeaa40be1b1438d","user":{"login":"Shopify","id":8085,"avatar_url":"https://avatars.githubusercontent.com/u/8085?v=3","gravatar_id":"","url":"https://api.github.com/users/Shopify","html_url":"https://github.com/Shopify","followers_url":"https://api.github.com/users/Shopify/followers","following_url":"https://api.github.com/users/Shopify/following{/other_user}","gists_url":"https://api.github.com/users/Shopify/gists{/gist_id}","starred_url":"https://api.github.com/users/Shopify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shopify/subscriptions","organizations_url":"https://api.github.com/users/Shopify/orgs","repos_url":"https://api.github.com/users/Shopify/repos","events_url":"https://api.github.com/users/Shopify/events{/privacy}","received_events_url":"https://api.github.com/users/Shopify/received_events","type":"Organization","site_admin":false},"repo":{"id":31735519,"name":"measured-rails","full_name":"Shopify/measured-rails","owner":{"login":"Shopify","id":8085,"avatar_url":"https://avatars.githubusercontent.com/u/8085?v=3","gravatar_id":"","url":"https://api.github.com/users/Shopify","html_url":"https://github.com/Shopify","followers_url":"https://api.github.com/users/Shopify/followers","following_url":"https://api.github.com/users/Shopify/following{/other_user}","gists_url":"https://api.github.com/users/Shopify/gists{/gist_id}","starred_url":"https://api.github.com/users/Shopify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shopify/subscriptions","organizations_url":"https://api.github.com/users/Shopify/orgs","repos_url":"https://api.github.com/users/Shopify/repos","events_url":"https://api.github.com/users/Shopify/events{/privacy}","received_events_url":"https://api.github.com/users/Shopify/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Shopify/measured-rails","description":"Rails adapter for the measured gem. Encapsulate measurements and their units in Ruby and Rails.","fork":false,"url":"https://api.github.com/repos/Shopify/measured-rails","forks_url":"https://api.github.com/repos/Shopify/measured-rails/forks","keys_url":"https://api.github.com/repos/Shopify/measured-rails/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Shopify/measured-rails/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Shopify/measured-rails/teams","hooks_url":"https://api.github.com/repos/Shopify/measured-rails/hooks","issue_events_url":"https://api.github.com/repos/Shopify/measured-rails/issues/events{/number}","events_url":"https://api.github.com/repos/Shopify/measured-rails/events","assignees_url":"https://api.github.com/repos/Shopify/measured-rails/assignees{/user}","branches_url":"https://api.github.com/repos/Shopify/measured-rails/branches{/branch}","tags_url":"https://api.github.com/repos/Shopify/measured-rails/tags","blobs_url":"https://api.github.com/repos/Shopify/measured-rails/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Shopify/measured-rails/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Shopify/measured-rails/git/refs{/sha}","trees_url":"https://api.github.com/repos/Shopify/measured-rails/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Shopify/measured-rails/statuses/{sha}","languages_url":"https://api.github.com/repos/Shopify/measured-rails/languages","stargazers_url":"https://api.github.com/repos/Shopify/measured-rails/stargazers","contributors_url":"https://api.github.com/repos/Shopify/measured-rails/contributors","subscribers_url":"https://api.github.com/repos/Shopify/measured-rails/subscribers","subscription_url":"https://api.github.com/repos/Shopify/measured-rails/subscription","commits_url":"https://api.github.com/repos/Shopify/measured-rails/commits{/sha}","git_commits_url":"https://api.github.com/repos/Shopify/measured-rails/git/commits{/sha}","comments_url":"https://api.github.com/repos/Shopify/measured-rails/comments{/number}","issue_comment_url":"https://api.github.com/repos/Shopify/measured-rails/issues/comments{/number}","contents_url":"https://api.github.com/repos/Shopify/measured-rails/contents/{+path}","compare_url":"https://api.github.com/repos/Shopify/measured-rails/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Shopify/measured-rails/merges","archive_url":"https://api.github.com/repos/Shopify/measured-rails/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Shopify/measured-rails/downloads","issues_url":"https://api.github.com/repos/Shopify/measured-rails/issues{/number}","pulls_url":"https://api.github.com/repos/Shopify/measured-rails/pulls{/number}","milestones_url":"https://api.github.com/repos/Shopify/measured-rails/milestones{/number}","notifications_url":"https://api.github.com/repos/Shopify/measured-rails/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Shopify/measured-rails/labels{/name}","releases_url":"https://api.github.com/repos/Shopify/measured-rails/releases{/id}","deployments_url":"https://api.github.com/repos/Shopify/measured-rails/deployments","created_at":"2015-03-05T20:48:38Z","updated_at":"2016-11-18T16:14:13Z","pushed_at":"2016-11-18T23:06:35Z","git_url":"git://github.com/Shopify/measured-rails.git","ssh_url":"git@github.com:Shopify/measured-rails.git","clone_url":"https://github.com/Shopify/measured-rails.git","svn_url":"https://github.com/Shopify/measured-rails","homepage":"","size":77,"stargazers_count":17,"watchers_count":17,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":17,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Shopify/measured-rails/pulls/27"},"html":{"href":"https://github.com/Shopify/measured-rails/pull/27"},"issue":{"href":"https://api.github.com/repos/Shopify/measured-rails/issues/27"},"comments":{"href":"https://api.github.com/repos/Shopify/measured-rails/issues/27/comments"},"review_comments":{"href":"https://api.github.com/repos/Shopify/measured-rails/pulls/27/comments"},"review_comment":{"href":"https://api.github.com/repos/Shopify/measured-rails/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Shopify/measured-rails/pulls/27/commits"},"statuses":{"href":"https://api.github.com/repos/Shopify/measured-rails/statuses/5e31de1ad179043d549c67b8b88c2145f99b1924"}}}}
{"actor":{"display_login":"Goldenson"}}