{"action":"created","comment":{"url":"https://api.github.com/repos/at-longhpv/buukstore/pulls/comments/61370721","id":61370721,"diff_hunk":"@@ -2,4 +2,24 @@ class OrderItem < ActiveRecord::Base\n   belongs_to :cart\n   belongs_to :user\n   has_one :book\n+  before_save :finalize\n+\n+  def total_price\n+    price_item * quanity\n+  end\n+\n+  def price_item\n+    if persisted?\n+      self[:price]\n+    else\n+      book.price\n+    end\n+  end\n+\n+  private\n+\n+    def finalize","path":"app/models/order_item.rb","position":20,"original_position":20,"commit_id":"df510599ccc2012f0bb784df3f5e850aa708d018","original_commit_id":"df510599ccc2012f0bb784df3f5e850aa708d018","user":{"login":"at-phuocdh","id":16131616,"avatar_url":"https://avatars.githubusercontent.com/u/16131616?v=3","gravatar_id":"","url":"https://api.github.com/users/at-phuocdh","html_url":"https://github.com/at-phuocdh","followers_url":"https://api.github.com/users/at-phuocdh/followers","following_url":"https://api.github.com/users/at-phuocdh/following{/other_user}","gists_url":"https://api.github.com/users/at-phuocdh/gists{/gist_id}","starred_url":"https://api.github.com/users/at-phuocdh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/at-phuocdh/subscriptions","organizations_url":"https://api.github.com/users/at-phuocdh/orgs","repos_url":"https://api.github.com/users/at-phuocdh/repos","events_url":"https://api.github.com/users/at-phuocdh/events{/privacy}","received_events_url":"https://api.github.com/users/at-phuocdh/received_events","type":"User","site_admin":false},"body":"Please change `finalize` to `set_item_value` or something else. it's not clear!","created_at":"2016-04-28T03:53:19Z","updated_at":"2016-04-28T03:53:19Z","html_url":"https://github.com/at-longhpv/buukstore/pull/12#discussion_r61370721","pull_request_url":"https://api.github.com/repos/at-longhpv/buukstore/pulls/12","_links":{"self":{"href":"https://api.github.com/repos/at-longhpv/buukstore/pulls/comments/61370721"},"html":{"href":"https://github.com/at-longhpv/buukstore/pull/12#discussion_r61370721"},"pull_request":{"href":"https://api.github.com/repos/at-longhpv/buukstore/pulls/12"}}},"pull_request":{"url":"https://api.github.com/repos/at-longhpv/buukstore/pulls/12","id":66617622,"html_url":"https://github.com/at-longhpv/buukstore/pull/12","diff_url":"https://github.com/at-longhpv/buukstore/pull/12.diff","patch_url":"https://github.com/at-longhpv/buukstore/pull/12.patch","issue_url":"https://api.github.com/repos/at-longhpv/buukstore/issues/12","number":12,"state":"open","locked":false,"title":"Feature/add to cart","user":{"login":"at-longhpv","id":17695632,"avatar_url":"https://avatars.githubusercontent.com/u/17695632?v=3","gravatar_id":"","url":"https://api.github.com/users/at-longhpv","html_url":"https://github.com/at-longhpv","followers_url":"https://api.github.com/users/at-longhpv/followers","following_url":"https://api.github.com/users/at-longhpv/following{/other_user}","gists_url":"https://api.github.com/users/at-longhpv/gists{/gist_id}","starred_url":"https://api.github.com/users/at-longhpv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/at-longhpv/subscriptions","organizations_url":"https://api.github.com/users/at-longhpv/orgs","repos_url":"https://api.github.com/users/at-longhpv/repos","events_url":"https://api.github.com/users/at-longhpv/events{/privacy}","received_events_url":"https://api.github.com/users/at-longhpv/received_events","type":"User","site_admin":false},"body":"Add book cart.\r\nUpdate quanity and delete book item\r\nTotal and subtotal price","created_at":"2016-04-15T09:56:41Z","updated_at":"2016-04-28T03:53:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f17d412474b26b8c7e1995f00828e367b5178788","assignee":{"login":"at-dypd","id":16137620,"avatar_url":"https://avatars.githubusercontent.com/u/16137620?v=3","gravatar_id":"","url":"https://api.github.com/users/at-dypd","html_url":"https://github.com/at-dypd","followers_url":"https://api.github.com/users/at-dypd/followers","following_url":"https://api.github.com/users/at-dypd/following{/other_user}","gists_url":"https://api.github.com/users/at-dypd/gists{/gist_id}","starred_url":"https://api.github.com/users/at-dypd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/at-dypd/subscriptions","organizations_url":"https://api.github.com/users/at-dypd/orgs","repos_url":"https://api.github.com/users/at-dypd/repos","events_url":"https://api.github.com/users/at-dypd/events{/privacy}","received_events_url":"https://api.github.com/users/at-dypd/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/at-longhpv/buukstore/pulls/12/commits","review_comments_url":"https://api.github.com/repos/at-longhpv/buukstore/pulls/12/comments","review_comment_url":"https://api.github.com/repos/at-longhpv/buukstore/pulls/comments{/number}","comments_url":"https://api.github.com/repos/at-longhpv/buukstore/issues/12/comments","statuses_url":"https://api.github.com/repos/at-longhpv/buukstore/statuses/df510599ccc2012f0bb784df3f5e850aa708d018","head":{"label":"at-longhpv:feature/add-to-cart","ref":"feature/add-to-cart","sha":"df510599ccc2012f0bb784df3f5e850aa708d018","user":{"login":"at-longhpv","id":17695632,"avatar_url":"https://avatars.githubusercontent.com/u/17695632?v=3","gravatar_id":"","url":"https://api.github.com/users/at-longhpv","html_url":"https://github.com/at-longhpv","followers_url":"https://api.github.com/users/at-longhpv/followers","following_url":"https://api.github.com/users/at-longhpv/following{/other_user}","gists_url":"https://api.github.com/users/at-longhpv/gists{/gist_id}","starred_url":"https://api.github.com/users/at-longhpv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/at-longhpv/subscriptions","organizations_url":"https://api.github.com/users/at-longhpv/orgs","repos_url":"https://api.github.com/users/at-longhpv/repos","events_url":"https://api.github.com/users/at-longhpv/events{/privacy}","received_events_url":"https://api.github.com/users/at-longhpv/received_events","type":"User","site_admin":false},"repo":{"id":54885179,"name":"buukstore","full_name":"at-longhpv/buukstore","owner":{"login":"at-longhpv","id":17695632,"avatar_url":"https://avatars.githubusercontent.com/u/17695632?v=3","gravatar_id":"","url":"https://api.github.com/users/at-longhpv","html_url":"https://github.com/at-longhpv","followers_url":"https://api.github.com/users/at-longhpv/followers","following_url":"https://api.github.com/users/at-longhpv/following{/other_user}","gists_url":"https://api.github.com/users/at-longhpv/gists{/gist_id}","starred_url":"https://api.github.com/users/at-longhpv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/at-longhpv/subscriptions","organizations_url":"https://api.github.com/users/at-longhpv/orgs","repos_url":"https://api.github.com/users/at-longhpv/repos","events_url":"https://api.github.com/users/at-longhpv/events{/privacy}","received_events_url":"https://api.github.com/users/at-longhpv/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/at-longhpv/buukstore","description":"Bookstore rails app","fork":false,"url":"https://api.github.com/repos/at-longhpv/buukstore","forks_url":"https://api.github.com/repos/at-longhpv/buukstore/forks","keys_url":"https://api.github.com/repos/at-longhpv/buukstore/keys{/key_id}","collaborators_url":"https://api.github.com/repos/at-longhpv/buukstore/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/at-longhpv/buukstore/teams","hooks_url":"https://api.github.com/repos/at-longhpv/buukstore/hooks","issue_events_url":"https://api.github.com/repos/at-longhpv/buukstore/issues/events{/number}","events_url":"https://api.github.com/repos/at-longhpv/buukstore/events","assignees_url":"https://api.github.com/repos/at-longhpv/buukstore/assignees{/user}","branches_url":"https://api.github.com/repos/at-longhpv/buukstore/branches{/branch}","tags_url":"https://api.github.com/repos/at-longhpv/buukstore/tags","blobs_url":"https://api.github.com/repos/at-longhpv/buukstore/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/at-longhpv/buukstore/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/at-longhpv/buukstore/git/refs{/sha}","trees_url":"https://api.github.com/repos/at-longhpv/buukstore/git/trees{/sha}","statuses_url":"https://api.github.com/repos/at-longhpv/buukstore/statuses/{sha}","languages_url":"https://api.github.com/repos/at-longhpv/buukstore/languages","stargazers_url":"https://api.github.com/repos/at-longhpv/buukstore/stargazers","contributors_url":"https://api.github.com/repos/at-longhpv/buukstore/contributors","subscribers_url":"https://api.github.com/repos/at-longhpv/buukstore/subscribers","subscription_url":"https://api.github.com/repos/at-longhpv/buukstore/subscription","commits_url":"https://api.github.com/repos/at-longhpv/buukstore/commits{/sha}","git_commits_url":"https://api.github.com/repos/at-longhpv/buukstore/git/commits{/sha}","comments_url":"https://api.github.com/repos/at-longhpv/buukstore/comments{/number}","issue_comment_url":"https://api.github.com/repos/at-longhpv/buukstore/issues/comments{/number}","contents_url":"https://api.github.com/repos/at-longhpv/buukstore/contents/{+path}","compare_url":"https://api.github.com/repos/at-longhpv/buukstore/compare/{base}...{head}","merges_url":"https://api.github.com/repos/at-longhpv/buukstore/merges","archive_url":"https://api.github.com/repos/at-longhpv/buukstore/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/at-longhpv/buukstore/downloads","issues_url":"https://api.github.com/repos/at-longhpv/buukstore/issues{/number}","pulls_url":"https://api.github.com/repos/at-longhpv/buukstore/pulls{/number}","milestones_url":"https://api.github.com/repos/at-longhpv/buukstore/milestones{/number}","notifications_url":"https://api.github.com/repos/at-longhpv/buukstore/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/at-longhpv/buukstore/labels{/name}","releases_url":"https://api.github.com/repos/at-longhpv/buukstore/releases{/id}","deployments_url":"https://api.github.com/repos/at-longhpv/buukstore/deployments","created_at":"2016-03-28T10:34:25Z","updated_at":"2016-04-13T09:45:22Z","pushed_at":"2016-04-26T07:01:49Z","git_url":"git://github.com/at-longhpv/buukstore.git","ssh_url":"git@github.com:at-longhpv/buukstore.git","clone_url":"https://github.com/at-longhpv/buukstore.git","svn_url":"https://github.com/at-longhpv/buukstore","homepage":null,"size":138,"stargazers_count":1,"watchers_count":1,"language":"HTML","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":1,"default_branch":"develop"}},"base":{"label":"at-longhpv:develop","ref":"develop","sha":"d8d94e2f9a2dd6e48478461133c1509dbb1abfd8","user":{"login":"at-longhpv","id":17695632,"avatar_url":"https://avatars.githubusercontent.com/u/17695632?v=3","gravatar_id":"","url":"https://api.github.com/users/at-longhpv","html_url":"https://github.com/at-longhpv","followers_url":"https://api.github.com/users/at-longhpv/followers","following_url":"https://api.github.com/users/at-longhpv/following{/other_user}","gists_url":"https://api.github.com/users/at-longhpv/gists{/gist_id}","starred_url":"https://api.github.com/users/at-longhpv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/at-longhpv/subscriptions","organizations_url":"https://api.github.com/users/at-longhpv/orgs","repos_url":"https://api.github.com/users/at-longhpv/repos","events_url":"https://api.github.com/users/at-longhpv/events{/privacy}","received_events_url":"https://api.github.com/users/at-longhpv/received_events","type":"User","site_admin":false},"repo":{"id":54885179,"name":"buukstore","full_name":"at-longhpv/buukstore","owner":{"login":"at-longhpv","id":17695632,"avatar_url":"https://avatars.githubusercontent.com/u/17695632?v=3","gravatar_id":"","url":"https://api.github.com/users/at-longhpv","html_url":"https://github.com/at-longhpv","followers_url":"https://api.github.com/users/at-longhpv/followers","following_url":"https://api.github.com/users/at-longhpv/following{/other_user}","gists_url":"https://api.github.com/users/at-longhpv/gists{/gist_id}","starred_url":"https://api.github.com/users/at-longhpv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/at-longhpv/subscriptions","organizations_url":"https://api.github.com/users/at-longhpv/orgs","repos_url":"https://api.github.com/users/at-longhpv/repos","events_url":"https://api.github.com/users/at-longhpv/events{/privacy}","received_events_url":"https://api.github.com/users/at-longhpv/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/at-longhpv/buukstore","description":"Bookstore rails app","fork":false,"url":"https://api.github.com/repos/at-longhpv/buukstore","forks_url":"https://api.github.com/repos/at-longhpv/buukstore/forks","keys_url":"https://api.github.com/repos/at-longhpv/buukstore/keys{/key_id}","collaborators_url":"https://api.github.com/repos/at-longhpv/buukstore/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/at-longhpv/buukstore/teams","hooks_url":"https://api.github.com/repos/at-longhpv/buukstore/hooks","issue_events_url":"https://api.github.com/repos/at-longhpv/buukstore/issues/events{/number}","events_url":"https://api.github.com/repos/at-longhpv/buukstore/events","assignees_url":"https://api.github.com/repos/at-longhpv/buukstore/assignees{/user}","branches_url":"https://api.github.com/repos/at-longhpv/buukstore/branches{/branch}","tags_url":"https://api.github.com/repos/at-longhpv/buukstore/tags","blobs_url":"https://api.github.com/repos/at-longhpv/buukstore/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/at-longhpv/buukstore/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/at-longhpv/buukstore/git/refs{/sha}","trees_url":"https://api.github.com/repos/at-longhpv/buukstore/git/trees{/sha}","statuses_url":"https://api.github.com/repos/at-longhpv/buukstore/statuses/{sha}","languages_url":"https://api.github.com/repos/at-longhpv/buukstore/languages","stargazers_url":"https://api.github.com/repos/at-longhpv/buukstore/stargazers","contributors_url":"https://api.github.com/repos/at-longhpv/buukstore/contributors","subscribers_url":"https://api.github.com/repos/at-longhpv/buukstore/subscribers","subscription_url":"https://api.github.com/repos/at-longhpv/buukstore/subscription","commits_url":"https://api.github.com/repos/at-longhpv/buukstore/commits{/sha}","git_commits_url":"https://api.github.com/repos/at-longhpv/buukstore/git/commits{/sha}","comments_url":"https://api.github.com/repos/at-longhpv/buukstore/comments{/number}","issue_comment_url":"https://api.github.com/repos/at-longhpv/buukstore/issues/comments{/number}","contents_url":"https://api.github.com/repos/at-longhpv/buukstore/contents/{+path}","compare_url":"https://api.github.com/repos/at-longhpv/buukstore/compare/{base}...{head}","merges_url":"https://api.github.com/repos/at-longhpv/buukstore/merges","archive_url":"https://api.github.com/repos/at-longhpv/buukstore/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/at-longhpv/buukstore/downloads","issues_url":"https://api.github.com/repos/at-longhpv/buukstore/issues{/number}","pulls_url":"https://api.github.com/repos/at-longhpv/buukstore/pulls{/number}","milestones_url":"https://api.github.com/repos/at-longhpv/buukstore/milestones{/number}","notifications_url":"https://api.github.com/repos/at-longhpv/buukstore/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/at-longhpv/buukstore/labels{/name}","releases_url":"https://api.github.com/repos/at-longhpv/buukstore/releases{/id}","deployments_url":"https://api.github.com/repos/at-longhpv/buukstore/deployments","created_at":"2016-03-28T10:34:25Z","updated_at":"2016-04-13T09:45:22Z","pushed_at":"2016-04-26T07:01:49Z","git_url":"git://github.com/at-longhpv/buukstore.git","ssh_url":"git@github.com:at-longhpv/buukstore.git","clone_url":"https://github.com/at-longhpv/buukstore.git","svn_url":"https://github.com/at-longhpv/buukstore","homepage":null,"size":138,"stargazers_count":1,"watchers_count":1,"language":"HTML","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":1,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/at-longhpv/buukstore/pulls/12"},"html":{"href":"https://github.com/at-longhpv/buukstore/pull/12"},"issue":{"href":"https://api.github.com/repos/at-longhpv/buukstore/issues/12"},"comments":{"href":"https://api.github.com/repos/at-longhpv/buukstore/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/at-longhpv/buukstore/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/at-longhpv/buukstore/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/at-longhpv/buukstore/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/at-longhpv/buukstore/statuses/df510599ccc2012f0bb784df3f5e850aa708d018"}}}}