{"action":"created","comment":{"url":"https://api.github.com/repos/bonobos/spree/pulls/comments/26336277","id":26336277,"diff_hunk":"@@ -0,0 +1,28 @@\n+class Spree::Carton < ActiveRecord::Base\n+  belongs_to :address, class_name: 'Spree::Address', inverse_of: :cartons\n+  belongs_to :stock_location, class_name: 'Spree::StockLocation', inverse_of: :cartons\n+  belongs_to :shipping_method, class_name: 'Spree::ShippingMethod', inverse_of: :cartons\n+\n+  has_many :inventory_units, inverse_of: :carton\n+  has_many :orders, -> { uniq }, through: :inventory_units\n+\n+  validates :address, presence: true\n+  validates :stock_location, presence: true\n+  validates :shipping_method, presence: true\n+  validates :inventory_units, presence: true\n+  validates :shipped_at, presence: true\n+\n+  make_permalink field: :number, length: 11, prefix: 'C'\n+\n+  scope :trackable, -> { where(\"tracking IS NOT NULL AND tracking != ''\") }\n+  # sort by most recent shipped_at, falling back to created_at. add \"id desc\" to make specs that involve this scope more deterministic.\n+  scope :reverse_chronological, -> { order(shipped_at: :desc, id: :desc) }\n+\n+  def to_param\n+    number\n+  end\n+\n+  def tracking_url","path":"core/app/models/spree/carton.rb","position":25,"original_position":25,"commit_id":"e4d689a76346bcce208a2482bb388c6420dd6457","original_commit_id":"3eacd2d30776e198fb7c80a0d398b2983fe63c12","user":{"login":"cbrunsdon","id":279013,"avatar_url":"https://avatars.githubusercontent.com/u/279013?v=3","gravatar_id":"","url":"https://api.github.com/users/cbrunsdon","html_url":"https://github.com/cbrunsdon","followers_url":"https://api.github.com/users/cbrunsdon/followers","following_url":"https://api.github.com/users/cbrunsdon/following{/other_user}","gists_url":"https://api.github.com/users/cbrunsdon/gists{/gist_id}","starred_url":"https://api.github.com/users/cbrunsdon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cbrunsdon/subscriptions","organizations_url":"https://api.github.com/users/cbrunsdon/orgs","repos_url":"https://api.github.com/users/cbrunsdon/repos","events_url":"https://api.github.com/users/cbrunsdon/events{/privacy}","received_events_url":"https://api.github.com/users/cbrunsdon/received_events","type":"User","site_admin":false},"body":"sorry, had one, was looking at wrong thing","created_at":"2015-03-12T19:32:20Z","updated_at":"2015-03-12T19:32:20Z","html_url":"https://github.com/bonobos/spree/pull/276#discussion_r26336277","pull_request_url":"https://api.github.com/repos/bonobos/spree/pulls/276","_links":{"self":{"href":"https://api.github.com/repos/bonobos/spree/pulls/comments/26336277"},"html":{"href":"https://github.com/bonobos/spree/pull/276#discussion_r26336277"},"pull_request":{"href":"https://api.github.com/repos/bonobos/spree/pulls/276"}}},"pull_request":{"url":"https://api.github.com/repos/bonobos/spree/pulls/276","id":30790701,"html_url":"https://github.com/bonobos/spree/pull/276","diff_url":"https://github.com/bonobos/spree/pull/276.diff","patch_url":"https://github.com/bonobos/spree/pull/276.patch","issue_url":"https://api.github.com/repos/bonobos/spree/issues/276","number":276,"state":"open","locked":false,"title":"Shipped Shipments represented as Spree::Carton - Step 1","user":{"login":"philbirt","id":208828,"avatar_url":"https://avatars.githubusercontent.com/u/208828?v=3","gravatar_id":"","url":"https://api.github.com/users/philbirt","html_url":"https://github.com/philbirt","followers_url":"https://api.github.com/users/philbirt/followers","following_url":"https://api.github.com/users/philbirt/following{/other_user}","gists_url":"https://api.github.com/users/philbirt/gists{/gist_id}","starred_url":"https://api.github.com/users/philbirt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/philbirt/subscriptions","organizations_url":"https://api.github.com/users/philbirt/orgs","repos_url":"https://api.github.com/users/philbirt/repos","events_url":"https://api.github.com/users/philbirt/events{/privacy}","received_events_url":"https://api.github.com/users/philbirt/received_events","type":"User","site_admin":false},"body":"We are going to split the shipped shipments represented at `Spree::Cartons` work into several roll-back-able chunks like we did for bulk promotions. This represents step 1, full plan outlined below:\r\n\r\nStep 1:\r\n- schema changes\r\n- mirrored data (do both: ship Shipments and create Cartons when `Shipment.ship!` is called)\r\n- move after_ship into OrderContents#ship_shipment\r\n\r\nStep 2:\r\n- Backfill old shipped shipments to have an associated Carton\r\n\r\nStep 3:\r\n- Wombat changes to support getting Cartons data to the correct places / Turn off associated shipment flows\r\n\r\nStep 4:\r\n- Admin UI pulls from Carton data instead of Shipment data\r\n- All other reads from shipped shipments should read from Cartons\r\n\r\nStep 5:\r\n- Stop writing data to Shipments for anything during or after `ship!`","created_at":"2015-03-09T19:16:24Z","updated_at":"2015-03-12T19:32:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f6f66d421dba1a2858adc16325f3bfe020ec6dfc","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/bonobos/spree/pulls/276/commits","review_comments_url":"https://api.github.com/repos/bonobos/spree/pulls/276/comments","review_comment_url":"https://api.github.com/repos/bonobos/spree/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bonobos/spree/issues/276/comments","statuses_url":"https://api.github.com/repos/bonobos/spree/statuses/e4d689a76346bcce208a2482bb388c6420dd6457","head":{"label":"bonobos:cartons-step-1","ref":"cartons-step-1","sha":"e4d689a76346bcce208a2482bb388c6420dd6457","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-03-11T20:27:10Z","pushed_at":"2015-03-12T19:31:54Z","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":77446,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":8,"forks":1,"open_issues":8,"watchers":1,"default_branch":"2-2-dev"}},"base":{"label":"bonobos:2-2-dev","ref":"2-2-dev","sha":"40b0efacde35e44555e1cbfb4da5296b8a3f03ab","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-03-11T20:27:10Z","pushed_at":"2015-03-12T19:31:54Z","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":77446,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":8,"forks":1,"open_issues":8,"watchers":1,"default_branch":"2-2-dev"}},"_links":{"self":{"href":"https://api.github.com/repos/bonobos/spree/pulls/276"},"html":{"href":"https://github.com/bonobos/spree/pull/276"},"issue":{"href":"https://api.github.com/repos/bonobos/spree/issues/276"},"comments":{"href":"https://api.github.com/repos/bonobos/spree/issues/276/comments"},"review_comments":{"href":"https://api.github.com/repos/bonobos/spree/pulls/276/comments"},"review_comment":{"href":"https://api.github.com/repos/bonobos/spree/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bonobos/spree/pulls/276/commits"},"statuses":{"href":"https://api.github.com/repos/bonobos/spree/statuses/e4d689a76346bcce208a2482bb388c6420dd6457"}}}}