{"action":"created","comment":{"url":"https://api.github.com/repos/spree/spree/pulls/comments/51783411","id":51783411,"diff_hunk":"@@ -438,14 +438,20 @@ def ensure_line_items_are_in_stock\n     end\n \n     def empty!\n-      line_items.destroy_all\n-      updater.update_item_count\n-      adjustments.destroy_all\n-      shipments.destroy_all\n-      state_changes.destroy_all\n+      if completed?\n+        raise Spree.t(:cannot_be_emptied_order_processed_already)","path":"core/app/models/spree/order.rb","position":10,"original_position":10,"commit_id":"d030cc80fda9d3023bb80bceff69467a0ae23dea","original_commit_id":"d030cc80fda9d3023bb80bceff69467a0ae23dea","user":{"login":"Mafi88","id":643748,"avatar_url":"https://avatars.githubusercontent.com/u/643748?v=3","gravatar_id":"","url":"https://api.github.com/users/Mafi88","html_url":"https://github.com/Mafi88","followers_url":"https://api.github.com/users/Mafi88/followers","following_url":"https://api.github.com/users/Mafi88/following{/other_user}","gists_url":"https://api.github.com/users/Mafi88/gists{/gist_id}","starred_url":"https://api.github.com/users/Mafi88/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mafi88/subscriptions","organizations_url":"https://api.github.com/users/Mafi88/orgs","repos_url":"https://api.github.com/users/Mafi88/repos","events_url":"https://api.github.com/users/Mafi88/events{/privacy}","received_events_url":"https://api.github.com/users/Mafi88/received_events","type":"User","site_admin":false},"body":"@tanmay3011 Yes, I meant translation key.\r\n```raise Spree.t(:cannot_empty_completed_order)```\r\ninstead of\r\n```raise Spree.t(:cannot_be_emptied_order_processed_already)```.","created_at":"2016-02-03T20:39:06Z","updated_at":"2016-02-03T20:39:06Z","html_url":"https://github.com/spree/spree/pull/6994#discussion_r51783411","pull_request_url":"https://api.github.com/repos/spree/spree/pulls/6994","_links":{"self":{"href":"https://api.github.com/repos/spree/spree/pulls/comments/51783411"},"html":{"href":"https://github.com/spree/spree/pull/6994#discussion_r51783411"},"pull_request":{"href":"https://api.github.com/repos/spree/spree/pulls/6994"}}},"pull_request":{"url":"https://api.github.com/repos/spree/spree/pulls/6994","id":58187280,"html_url":"https://github.com/spree/spree/pull/6994","diff_url":"https://github.com/spree/spree/pull/6994.diff","patch_url":"https://github.com/spree/spree/pull/6994.patch","issue_url":"https://api.github.com/repos/spree/spree/issues/6994","number":6994,"state":"open","locked":false,"title":"Fix Order#empty! update order's state to cart if order not completed …","user":{"login":"tanmay3011","id":4212447,"avatar_url":"https://avatars.githubusercontent.com/u/4212447?v=3","gravatar_id":"","url":"https://api.github.com/users/tanmay3011","html_url":"https://github.com/tanmay3011","followers_url":"https://api.github.com/users/tanmay3011/followers","following_url":"https://api.github.com/users/tanmay3011/following{/other_user}","gists_url":"https://api.github.com/users/tanmay3011/gists{/gist_id}","starred_url":"https://api.github.com/users/tanmay3011/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tanmay3011/subscriptions","organizations_url":"https://api.github.com/users/tanmay3011/orgs","repos_url":"https://api.github.com/users/tanmay3011/repos","events_url":"https://api.github.com/users/tanmay3011/events{/privacy}","received_events_url":"https://api.github.com/users/tanmay3011/received_events","type":"User","site_admin":false},"body":"…else raise error #6901","created_at":"2016-02-03T19:26:12Z","updated_at":"2016-02-03T20:39:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c54fa5f7ea16461a574dbf416cd375b236041c8e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/spree/spree/pulls/6994/commits","review_comments_url":"https://api.github.com/repos/spree/spree/pulls/6994/comments","review_comment_url":"https://api.github.com/repos/spree/spree/pulls/comments{/number}","comments_url":"https://api.github.com/repos/spree/spree/issues/6994/comments","statuses_url":"https://api.github.com/repos/spree/spree/statuses/d030cc80fda9d3023bb80bceff69467a0ae23dea","head":{"label":"vinsol:order-update-empty","ref":"order-update-empty","sha":"d030cc80fda9d3023bb80bceff69467a0ae23dea","user":{"login":"vinsol","id":72388,"avatar_url":"https://avatars.githubusercontent.com/u/72388?v=3","gravatar_id":"","url":"https://api.github.com/users/vinsol","html_url":"https://github.com/vinsol","followers_url":"https://api.github.com/users/vinsol/followers","following_url":"https://api.github.com/users/vinsol/following{/other_user}","gists_url":"https://api.github.com/users/vinsol/gists{/gist_id}","starred_url":"https://api.github.com/users/vinsol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vinsol/subscriptions","organizations_url":"https://api.github.com/users/vinsol/orgs","repos_url":"https://api.github.com/users/vinsol/repos","events_url":"https://api.github.com/users/vinsol/events{/privacy}","received_events_url":"https://api.github.com/users/vinsol/received_events","type":"Organization","site_admin":false},"repo":{"id":50100254,"name":"spree","full_name":"vinsol/spree","owner":{"login":"vinsol","id":72388,"avatar_url":"https://avatars.githubusercontent.com/u/72388?v=3","gravatar_id":"","url":"https://api.github.com/users/vinsol","html_url":"https://github.com/vinsol","followers_url":"https://api.github.com/users/vinsol/followers","following_url":"https://api.github.com/users/vinsol/following{/other_user}","gists_url":"https://api.github.com/users/vinsol/gists{/gist_id}","starred_url":"https://api.github.com/users/vinsol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vinsol/subscriptions","organizations_url":"https://api.github.com/users/vinsol/orgs","repos_url":"https://api.github.com/users/vinsol/repos","events_url":"https://api.github.com/users/vinsol/events{/privacy}","received_events_url":"https://api.github.com/users/vinsol/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/vinsol/spree","description":"Spree is a complete open source e-commerce solution for Ruby on Rails.","fork":true,"url":"https://api.github.com/repos/vinsol/spree","forks_url":"https://api.github.com/repos/vinsol/spree/forks","keys_url":"https://api.github.com/repos/vinsol/spree/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vinsol/spree/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vinsol/spree/teams","hooks_url":"https://api.github.com/repos/vinsol/spree/hooks","issue_events_url":"https://api.github.com/repos/vinsol/spree/issues/events{/number}","events_url":"https://api.github.com/repos/vinsol/spree/events","assignees_url":"https://api.github.com/repos/vinsol/spree/assignees{/user}","branches_url":"https://api.github.com/repos/vinsol/spree/branches{/branch}","tags_url":"https://api.github.com/repos/vinsol/spree/tags","blobs_url":"https://api.github.com/repos/vinsol/spree/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vinsol/spree/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vinsol/spree/git/refs{/sha}","trees_url":"https://api.github.com/repos/vinsol/spree/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vinsol/spree/statuses/{sha}","languages_url":"https://api.github.com/repos/vinsol/spree/languages","stargazers_url":"https://api.github.com/repos/vinsol/spree/stargazers","contributors_url":"https://api.github.com/repos/vinsol/spree/contributors","subscribers_url":"https://api.github.com/repos/vinsol/spree/subscribers","subscription_url":"https://api.github.com/repos/vinsol/spree/subscription","commits_url":"https://api.github.com/repos/vinsol/spree/commits{/sha}","git_commits_url":"https://api.github.com/repos/vinsol/spree/git/commits{/sha}","comments_url":"https://api.github.com/repos/vinsol/spree/comments{/number}","issue_comment_url":"https://api.github.com/repos/vinsol/spree/issues/comments{/number}","contents_url":"https://api.github.com/repos/vinsol/spree/contents/{+path}","compare_url":"https://api.github.com/repos/vinsol/spree/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vinsol/spree/merges","archive_url":"https://api.github.com/repos/vinsol/spree/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vinsol/spree/downloads","issues_url":"https://api.github.com/repos/vinsol/spree/issues{/number}","pulls_url":"https://api.github.com/repos/vinsol/spree/pulls{/number}","milestones_url":"https://api.github.com/repos/vinsol/spree/milestones{/number}","notifications_url":"https://api.github.com/repos/vinsol/spree/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vinsol/spree/labels{/name}","releases_url":"https://api.github.com/repos/vinsol/spree/releases{/id}","deployments_url":"https://api.github.com/repos/vinsol/spree/deployments","created_at":"2016-01-21T10:30:54Z","updated_at":"2016-01-21T10:31:01Z","pushed_at":"2016-02-03T20:35:28Z","git_url":"git://github.com/vinsol/spree.git","ssh_url":"git@github.com:vinsol/spree.git","clone_url":"https://github.com/vinsol/spree.git","svn_url":"https://github.com/vinsol/spree","homepage":"http://spreecommerce.com","size":74737,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":15,"forks":3,"open_issues":15,"watchers":0,"default_branch":"master"}},"base":{"label":"spree:master","ref":"master","sha":"82313f5cb46142b182b6b4b1688c7023ea287ef6","user":{"login":"spree","id":56702,"avatar_url":"https://avatars.githubusercontent.com/u/56702?v=3","gravatar_id":"","url":"https://api.github.com/users/spree","html_url":"https://github.com/spree","followers_url":"https://api.github.com/users/spree/followers","following_url":"https://api.github.com/users/spree/following{/other_user}","gists_url":"https://api.github.com/users/spree/gists{/gist_id}","starred_url":"https://api.github.com/users/spree/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spree/subscriptions","organizations_url":"https://api.github.com/users/spree/orgs","repos_url":"https://api.github.com/users/spree/repos","events_url":"https://api.github.com/users/spree/events{/privacy}","received_events_url":"https://api.github.com/users/spree/received_events","type":"Organization","site_admin":false},"repo":{"id":3314,"name":"spree","full_name":"spree/spree","owner":{"login":"spree","id":56702,"avatar_url":"https://avatars.githubusercontent.com/u/56702?v=3","gravatar_id":"","url":"https://api.github.com/users/spree","html_url":"https://github.com/spree","followers_url":"https://api.github.com/users/spree/followers","following_url":"https://api.github.com/users/spree/following{/other_user}","gists_url":"https://api.github.com/users/spree/gists{/gist_id}","starred_url":"https://api.github.com/users/spree/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spree/subscriptions","organizations_url":"https://api.github.com/users/spree/orgs","repos_url":"https://api.github.com/users/spree/repos","events_url":"https://api.github.com/users/spree/events{/privacy}","received_events_url":"https://api.github.com/users/spree/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/spree/spree","description":"Spree is a complete open source e-commerce solution for Ruby on Rails.","fork":false,"url":"https://api.github.com/repos/spree/spree","forks_url":"https://api.github.com/repos/spree/spree/forks","keys_url":"https://api.github.com/repos/spree/spree/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spree/spree/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spree/spree/teams","hooks_url":"https://api.github.com/repos/spree/spree/hooks","issue_events_url":"https://api.github.com/repos/spree/spree/issues/events{/number}","events_url":"https://api.github.com/repos/spree/spree/events","assignees_url":"https://api.github.com/repos/spree/spree/assignees{/user}","branches_url":"https://api.github.com/repos/spree/spree/branches{/branch}","tags_url":"https://api.github.com/repos/spree/spree/tags","blobs_url":"https://api.github.com/repos/spree/spree/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spree/spree/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spree/spree/git/refs{/sha}","trees_url":"https://api.github.com/repos/spree/spree/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spree/spree/statuses/{sha}","languages_url":"https://api.github.com/repos/spree/spree/languages","stargazers_url":"https://api.github.com/repos/spree/spree/stargazers","contributors_url":"https://api.github.com/repos/spree/spree/contributors","subscribers_url":"https://api.github.com/repos/spree/spree/subscribers","subscription_url":"https://api.github.com/repos/spree/spree/subscription","commits_url":"https://api.github.com/repos/spree/spree/commits{/sha}","git_commits_url":"https://api.github.com/repos/spree/spree/git/commits{/sha}","comments_url":"https://api.github.com/repos/spree/spree/comments{/number}","issue_comment_url":"https://api.github.com/repos/spree/spree/issues/comments{/number}","contents_url":"https://api.github.com/repos/spree/spree/contents/{+path}","compare_url":"https://api.github.com/repos/spree/spree/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spree/spree/merges","archive_url":"https://api.github.com/repos/spree/spree/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spree/spree/downloads","issues_url":"https://api.github.com/repos/spree/spree/issues{/number}","pulls_url":"https://api.github.com/repos/spree/spree/pulls{/number}","milestones_url":"https://api.github.com/repos/spree/spree/milestones{/number}","notifications_url":"https://api.github.com/repos/spree/spree/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spree/spree/labels{/name}","releases_url":"https://api.github.com/repos/spree/spree/releases{/id}","deployments_url":"https://api.github.com/repos/spree/spree/deployments","created_at":"2008-03-10T14:45:35Z","updated_at":"2016-02-03T18:23:56Z","pushed_at":"2016-02-03T19:57:08Z","git_url":"git://github.com/spree/spree.git","ssh_url":"git@github.com:spree/spree.git","clone_url":"https://github.com/spree/spree.git","svn_url":"https://github.com/spree/spree","homepage":"http://spreecommerce.com","size":99620,"stargazers_count":7125,"watchers_count":7125,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3366,"mirror_url":null,"open_issues_count":233,"forks":3366,"open_issues":233,"watchers":7125,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/spree/spree/pulls/6994"},"html":{"href":"https://github.com/spree/spree/pull/6994"},"issue":{"href":"https://api.github.com/repos/spree/spree/issues/6994"},"comments":{"href":"https://api.github.com/repos/spree/spree/issues/6994/comments"},"review_comments":{"href":"https://api.github.com/repos/spree/spree/pulls/6994/comments"},"review_comment":{"href":"https://api.github.com/repos/spree/spree/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/spree/spree/pulls/6994/commits"},"statuses":{"href":"https://api.github.com/repos/spree/spree/statuses/d030cc80fda9d3023bb80bceff69467a0ae23dea"}}}}