{"action":"created","comment":{"url":"https://api.github.com/repos/bonobos/spree/pulls/comments/35143337","id":35143337,"diff_hunk":"@@ -0,0 +1,63 @@\n+module Spree\n+  module UserAddressBook\n+    extend ActiveSupport::Concern\n+\n+    included do\n+      belongs_to :bill_address, foreign_key: :bill_address_id, class_name: 'Spree::Address'\n+      alias_attribute :billing_address, :bill_address\n+      accepts_nested_attributes_for :bill_address #TODO update like ship_address\n+\n+      #TODO ship_address_id column can be removed from Users table in db\n+\n+      has_many :user_addresses, foreign_key: \"user_id\", class_name: \"Spree::UserAddress\"\n+      has_many :addresses, through: :user_addresses\n+\n+      has_one :default_user_address, -> { where default: true}, foreign_key: \"user_id\", class_name: 'Spree::UserAddress'\n+      has_one :default_address, through: :default_user_address, source: :address\n+\n+      # TODO - once payment sources have a bill_address\n+      #def bill_address\n+        #self.default_credit_card.try!(:bill_address) || default_address\n+      #end\n+\n+      # These ship and bill address methods preserve backwards compatability\n+      # with admin and the default spree frontend\n+\n+      def ship_address\n+        default_address\n+      end\n+      alias_method :shiping_address, :ship_address #TODO verify this is needed","path":"core/app/models/concerns/spree/user_address_book.rb","position":29,"original_position":29,"commit_id":"9b654a4327a751487f35b9061d2d6daf5231c2a5","original_commit_id":"9b654a4327a751487f35b9061d2d6daf5231c2a5","user":{"login":"gvaughn","id":10173,"avatar_url":"https://avatars.githubusercontent.com/u/10173?v=3","gravatar_id":"","url":"https://api.github.com/users/gvaughn","html_url":"https://github.com/gvaughn","followers_url":"https://api.github.com/users/gvaughn/followers","following_url":"https://api.github.com/users/gvaughn/following{/other_user}","gists_url":"https://api.github.com/users/gvaughn/gists{/gist_id}","starred_url":"https://api.github.com/users/gvaughn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gvaughn/subscriptions","organizations_url":"https://api.github.com/users/gvaughn/orgs","repos_url":"https://api.github.com/users/gvaughn/repos","events_url":"https://api.github.com/users/gvaughn/events{/privacy}","received_events_url":"https://api.github.com/users/gvaughn/received_events","type":"User","site_admin":false},"body":"That misspelling is interesting. I have the TODO to see if it is necessary. Yet no tests have failed as a result of misspelling it. I'll either remove or correct the spelling.","created_at":"2015-07-21T19:25:23Z","updated_at":"2015-07-21T19:25:23Z","html_url":"https://github.com/bonobos/spree/pull/428#discussion_r35143337","pull_request_url":"https://api.github.com/repos/bonobos/spree/pulls/428","_links":{"self":{"href":"https://api.github.com/repos/bonobos/spree/pulls/comments/35143337"},"html":{"href":"https://github.com/bonobos/spree/pull/428#discussion_r35143337"},"pull_request":{"href":"https://api.github.com/repos/bonobos/spree/pulls/428"}}},"pull_request":{"url":"https://api.github.com/repos/bonobos/spree/pulls/428","id":40265288,"html_url":"https://github.com/bonobos/spree/pull/428","diff_url":"https://github.com/bonobos/spree/pull/428.diff","patch_url":"https://github.com/bonobos/spree/pull/428.patch","issue_url":"https://api.github.com/repos/bonobos/spree/issues/428","number":428,"state":"open","locked":false,"title":"Implementing a user's address book model layer","user":{"login":"gvaughn","id":10173,"avatar_url":"https://avatars.githubusercontent.com/u/10173?v=3","gravatar_id":"","url":"https://api.github.com/users/gvaughn","html_url":"https://github.com/gvaughn","followers_url":"https://api.github.com/users/gvaughn/followers","following_url":"https://api.github.com/users/gvaughn/following{/other_user}","gists_url":"https://api.github.com/users/gvaughn/gists{/gist_id}","starred_url":"https://api.github.com/users/gvaughn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gvaughn/subscriptions","organizations_url":"https://api.github.com/users/gvaughn/orgs","repos_url":"https://api.github.com/users/gvaughn/repos","events_url":"https://api.github.com/users/gvaughn/events{/privacy}","received_events_url":"https://api.github.com/users/gvaughn/received_events","type":"User","site_admin":false},"body":"Consists of:\r\n* a UserAddressBook module for inclusion into User model\r\n* a UserAddress join model to include default flag\r\n* tracking down a soon-to-be obsolete UserAddress module and claiming the name\r\n* making Address readonly with copy-on-write behavior\r\n* removing defensive cloning of Address\r\n* backwards compatibility with existing Order address behavior, but adding a User reference to the address\r\n* backwards compatability for frontend, backend behavior relying on accepts_nested_attributes_for\r\n* a rake task/migration to backfill data into new model\r\n\r\nThis is setup work to allow us to surface new behavior in My Account and\r\nCheckout, but as it, you should not see anything new. That also means it\r\nshould not break anything.\r\n\r\nbillling addresses will get a similar reference in user's address book\r\nonce the credit-card-bill-address PR is merged","created_at":"2015-07-17T19:48:53Z","updated_at":"2015-07-21T19:25:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6b62e9fffbbf7a3851066064b26556b31711f735","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/bonobos/spree/pulls/428/commits","review_comments_url":"https://api.github.com/repos/bonobos/spree/pulls/428/comments","review_comment_url":"https://api.github.com/repos/bonobos/spree/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bonobos/spree/issues/428/comments","statuses_url":"https://api.github.com/repos/bonobos/spree/statuses/9b654a4327a751487f35b9061d2d6daf5231c2a5","head":{"label":"bonobos:address-book","ref":"address-book","sha":"9b654a4327a751487f35b9061d2d6daf5231c2a5","user":{"login":"bonobos","id":78914,"avatar_url":"https://avatars.githubusercontent.com/u/78914?v=3","gravatar_id":"","url":"https://api.github.com/users/bonobos","html_url":"https://github.com/bonobos","followers_url":"https://api.github.com/users/bonobos/followers","following_url":"https://api.github.com/users/bonobos/following{/other_user}","gists_url":"https://api.github.com/users/bonobos/gists{/gist_id}","starred_url":"https://api.github.com/users/bonobos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bonobos/subscriptions","organizations_url":"https://api.github.com/users/bonobos/orgs","repos_url":"https://api.github.com/users/bonobos/repos","events_url":"https://api.github.com/users/bonobos/events{/privacy}","received_events_url":"https://api.github.com/users/bonobos/received_events","type":"Organization","site_admin":false},"repo":{"id":12625383,"name":"spree","full_name":"bonobos/spree","owner":{"login":"bonobos","id":78914,"avatar_url":"https://avatars.githubusercontent.com/u/78914?v=3","gravatar_id":"","url":"https://api.github.com/users/bonobos","html_url":"https://github.com/bonobos","followers_url":"https://api.github.com/users/bonobos/followers","following_url":"https://api.github.com/users/bonobos/following{/other_user}","gists_url":"https://api.github.com/users/bonobos/gists{/gist_id}","starred_url":"https://api.github.com/users/bonobos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bonobos/subscriptions","organizations_url":"https://api.github.com/users/bonobos/orgs","repos_url":"https://api.github.com/users/bonobos/repos","events_url":"https://api.github.com/users/bonobos/events{/privacy}","received_events_url":"https://api.github.com/users/bonobos/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bonobos/spree","description":"Spree is a complete open source e-commerce solution for Ruby on Rails.","fork":true,"url":"https://api.github.com/repos/bonobos/spree","forks_url":"https://api.github.com/repos/bonobos/spree/forks","keys_url":"https://api.github.com/repos/bonobos/spree/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bonobos/spree/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bonobos/spree/teams","hooks_url":"https://api.github.com/repos/bonobos/spree/hooks","issue_events_url":"https://api.github.com/repos/bonobos/spree/issues/events{/number}","events_url":"https://api.github.com/repos/bonobos/spree/events","assignees_url":"https://api.github.com/repos/bonobos/spree/assignees{/user}","branches_url":"https://api.github.com/repos/bonobos/spree/branches{/branch}","tags_url":"https://api.github.com/repos/bonobos/spree/tags","blobs_url":"https://api.github.com/repos/bonobos/spree/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bonobos/spree/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bonobos/spree/git/refs{/sha}","trees_url":"https://api.github.com/repos/bonobos/spree/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bonobos/spree/statuses/{sha}","languages_url":"https://api.github.com/repos/bonobos/spree/languages","stargazers_url":"https://api.github.com/repos/bonobos/spree/stargazers","contributors_url":"https://api.github.com/repos/bonobos/spree/contributors","subscribers_url":"https://api.github.com/repos/bonobos/spree/subscribers","subscription_url":"https://api.github.com/repos/bonobos/spree/subscription","commits_url":"https://api.github.com/repos/bonobos/spree/commits{/sha}","git_commits_url":"https://api.github.com/repos/bonobos/spree/git/commits{/sha}","comments_url":"https://api.github.com/repos/bonobos/spree/comments{/number}","issue_comment_url":"https://api.github.com/repos/bonobos/spree/issues/comments{/number}","contents_url":"https://api.github.com/repos/bonobos/spree/contents/{+path}","compare_url":"https://api.github.com/repos/bonobos/spree/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bonobos/spree/merges","archive_url":"https://api.github.com/repos/bonobos/spree/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bonobos/spree/downloads","issues_url":"https://api.github.com/repos/bonobos/spree/issues{/number}","pulls_url":"https://api.github.com/repos/bonobos/spree/pulls{/number}","milestones_url":"https://api.github.com/repos/bonobos/spree/milestones{/number}","notifications_url":"https://api.github.com/repos/bonobos/spree/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bonobos/spree/labels{/name}","releases_url":"https://api.github.com/repos/bonobos/spree/releases{/id}","created_at":"2013-09-05T18:28:25Z","updated_at":"2015-05-07T18:58:45Z","pushed_at":"2015-07-21T15:57:26Z","git_url":"git://github.com/bonobos/spree.git","ssh_url":"git@github.com:bonobos/spree.git","clone_url":"https://github.com/bonobos/spree.git","svn_url":"https://github.com/bonobos/spree","homepage":"http://spreecommerce.com","size":80836,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":4,"forks":2,"open_issues":4,"watchers":1,"default_branch":"2-2-dev"}},"base":{"label":"bonobos:2-2-dev","ref":"2-2-dev","sha":"826095a778dcd48cf3566ff9daa7fe7198b1079e","user":{"login":"bonobos","id":78914,"avatar_url":"https://avatars.githubusercontent.com/u/78914?v=3","gravatar_id":"","url":"https://api.github.com/users/bonobos","html_url":"https://github.com/bonobos","followers_url":"https://api.github.com/users/bonobos/followers","following_url":"https://api.github.com/users/bonobos/following{/other_user}","gists_url":"https://api.github.com/users/bonobos/gists{/gist_id}","starred_url":"https://api.github.com/users/bonobos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bonobos/subscriptions","organizations_url":"https://api.github.com/users/bonobos/orgs","repos_url":"https://api.github.com/users/bonobos/repos","events_url":"https://api.github.com/users/bonobos/events{/privacy}","received_events_url":"https://api.github.com/users/bonobos/received_events","type":"Organization","site_admin":false},"repo":{"id":12625383,"name":"spree","full_name":"bonobos/spree","owner":{"login":"bonobos","id":78914,"avatar_url":"https://avatars.githubusercontent.com/u/78914?v=3","gravatar_id":"","url":"https://api.github.com/users/bonobos","html_url":"https://github.com/bonobos","followers_url":"https://api.github.com/users/bonobos/followers","following_url":"https://api.github.com/users/bonobos/following{/other_user}","gists_url":"https://api.github.com/users/bonobos/gists{/gist_id}","starred_url":"https://api.github.com/users/bonobos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bonobos/subscriptions","organizations_url":"https://api.github.com/users/bonobos/orgs","repos_url":"https://api.github.com/users/bonobos/repos","events_url":"https://api.github.com/users/bonobos/events{/privacy}","received_events_url":"https://api.github.com/users/bonobos/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bonobos/spree","description":"Spree is a complete open source e-commerce solution for Ruby on Rails.","fork":true,"url":"https://api.github.com/repos/bonobos/spree","forks_url":"https://api.github.com/repos/bonobos/spree/forks","keys_url":"https://api.github.com/repos/bonobos/spree/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bonobos/spree/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bonobos/spree/teams","hooks_url":"https://api.github.com/repos/bonobos/spree/hooks","issue_events_url":"https://api.github.com/repos/bonobos/spree/issues/events{/number}","events_url":"https://api.github.com/repos/bonobos/spree/events","assignees_url":"https://api.github.com/repos/bonobos/spree/assignees{/user}","branches_url":"https://api.github.com/repos/bonobos/spree/branches{/branch}","tags_url":"https://api.github.com/repos/bonobos/spree/tags","blobs_url":"https://api.github.com/repos/bonobos/spree/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bonobos/spree/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bonobos/spree/git/refs{/sha}","trees_url":"https://api.github.com/repos/bonobos/spree/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bonobos/spree/statuses/{sha}","languages_url":"https://api.github.com/repos/bonobos/spree/languages","stargazers_url":"https://api.github.com/repos/bonobos/spree/stargazers","contributors_url":"https://api.github.com/repos/bonobos/spree/contributors","subscribers_url":"https://api.github.com/repos/bonobos/spree/subscribers","subscription_url":"https://api.github.com/repos/bonobos/spree/subscription","commits_url":"https://api.github.com/repos/bonobos/spree/commits{/sha}","git_commits_url":"https://api.github.com/repos/bonobos/spree/git/commits{/sha}","comments_url":"https://api.github.com/repos/bonobos/spree/comments{/number}","issue_comment_url":"https://api.github.com/repos/bonobos/spree/issues/comments{/number}","contents_url":"https://api.github.com/repos/bonobos/spree/contents/{+path}","compare_url":"https://api.github.com/repos/bonobos/spree/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bonobos/spree/merges","archive_url":"https://api.github.com/repos/bonobos/spree/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bonobos/spree/downloads","issues_url":"https://api.github.com/repos/bonobos/spree/issues{/number}","pulls_url":"https://api.github.com/repos/bonobos/spree/pulls{/number}","milestones_url":"https://api.github.com/repos/bonobos/spree/milestones{/number}","notifications_url":"https://api.github.com/repos/bonobos/spree/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bonobos/spree/labels{/name}","releases_url":"https://api.github.com/repos/bonobos/spree/releases{/id}","created_at":"2013-09-05T18:28:25Z","updated_at":"2015-05-07T18:58:45Z","pushed_at":"2015-07-21T15:57:26Z","git_url":"git://github.com/bonobos/spree.git","ssh_url":"git@github.com:bonobos/spree.git","clone_url":"https://github.com/bonobos/spree.git","svn_url":"https://github.com/bonobos/spree","homepage":"http://spreecommerce.com","size":80836,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":4,"forks":2,"open_issues":4,"watchers":1,"default_branch":"2-2-dev"}},"_links":{"self":{"href":"https://api.github.com/repos/bonobos/spree/pulls/428"},"html":{"href":"https://github.com/bonobos/spree/pull/428"},"issue":{"href":"https://api.github.com/repos/bonobos/spree/issues/428"},"comments":{"href":"https://api.github.com/repos/bonobos/spree/issues/428/comments"},"review_comments":{"href":"https://api.github.com/repos/bonobos/spree/pulls/428/comments"},"review_comment":{"href":"https://api.github.com/repos/bonobos/spree/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bonobos/spree/pulls/428/commits"},"statuses":{"href":"https://api.github.com/repos/bonobos/spree/statuses/9b654a4327a751487f35b9061d2d6daf5231c2a5"}}}}