{"action":"created","comment":{"url":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/pulls/comments/60777667","id":60777667,"diff_hunk":"@@ -7,4 +7,31 @@ class Deck < ActiveRecord::Base\n   validates :title, presence: true, uniqueness: {\n               scope: :user_id\n             }\n+\n+  def add_cards(cards)\n+    deck_cards = cards.map do |name, quantity|\n+      card = Card.find_by(name: name)\n+      deck_card = DeckCard.new(card_id: card.id, quantity: quantity)\n+    end\n+    self.deck_cards = self.deck_cards + deck_cards\n+  end\n+\n+  def sample_deck\n+    self.cards.sample(7)\n+  end\n+\n+  def card_type_curve\n+    type_count = Hash.new\n+    card_type = self.cards.card_type.to_a","path":"app/models/deck.rb","position":19,"original_position":19,"commit_id":"7ece924ee16eb27dfe123a921dd581c21cda3e12","original_commit_id":"7ece924ee16eb27dfe123a921dd581c21cda3e12","user":{"login":"kingcons","id":127439,"avatar_url":"https://avatars.githubusercontent.com/u/127439?v=3","gravatar_id":"","url":"https://api.github.com/users/kingcons","html_url":"https://github.com/kingcons","followers_url":"https://api.github.com/users/kingcons/followers","following_url":"https://api.github.com/users/kingcons/following{/other_user}","gists_url":"https://api.github.com/users/kingcons/gists{/gist_id}","starred_url":"https://api.github.com/users/kingcons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kingcons/subscriptions","organizations_url":"https://api.github.com/users/kingcons/orgs","repos_url":"https://api.github.com/users/kingcons/repos","events_url":"https://api.github.com/users/kingcons/events{/privacy}","received_events_url":"https://api.github.com/users/kingcons/received_events","type":"User","site_admin":false},"body":"`self.cards.card_type` is a common mistake to make. `cards` is a has_many meaning that what you'll get back is an ActiveRecord relation containing a bunch of cards. You can't call `card_type` on a *relation* or *array of cards*, you can only call `card_type` on a *single* card.","created_at":"2016-04-22T17:53:51Z","updated_at":"2016-04-22T17:53:51Z","html_url":"https://github.com/TIY-ATL-ROR-2016-Feb/planeswalkr/pull/49#discussion_r60777667","pull_request_url":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/pulls/49","_links":{"self":{"href":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/pulls/comments/60777667"},"html":{"href":"https://github.com/TIY-ATL-ROR-2016-Feb/planeswalkr/pull/49#discussion_r60777667"},"pull_request":{"href":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/pulls/49"}}},"pull_request":{"url":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/pulls/49","id":67530003,"html_url":"https://github.com/TIY-ATL-ROR-2016-Feb/planeswalkr/pull/49","diff_url":"https://github.com/TIY-ATL-ROR-2016-Feb/planeswalkr/pull/49.diff","patch_url":"https://github.com/TIY-ATL-ROR-2016-Feb/planeswalkr/pull/49.patch","issue_url":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/issues/49","number":49,"state":"open","locked":false,"title":"Deckextras","user":{"login":"jennifercford","id":17389600,"avatar_url":"https://avatars.githubusercontent.com/u/17389600?v=3","gravatar_id":"","url":"https://api.github.com/users/jennifercford","html_url":"https://github.com/jennifercford","followers_url":"https://api.github.com/users/jennifercford/followers","following_url":"https://api.github.com/users/jennifercford/following{/other_user}","gists_url":"https://api.github.com/users/jennifercford/gists{/gist_id}","starred_url":"https://api.github.com/users/jennifercford/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jennifercford/subscriptions","organizations_url":"https://api.github.com/users/jennifercford/orgs","repos_url":"https://api.github.com/users/jennifercford/repos","events_url":"https://api.github.com/users/jennifercford/events{/privacy}","received_events_url":"https://api.github.com/users/jennifercford/received_events","type":"User","site_admin":false},"body":"Will what I wrote work??? ","created_at":"2016-04-22T15:29:27Z","updated_at":"2016-04-22T17:53:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bd165f87edf6cb2f0211b66f8ecb4efa2f3edb0b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/pulls/49/commits","review_comments_url":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/pulls/49/comments","review_comment_url":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/pulls/comments{/number}","comments_url":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/issues/49/comments","statuses_url":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/statuses/7ece924ee16eb27dfe123a921dd581c21cda3e12","head":{"label":"jennifercford:deckextras","ref":"deckextras","sha":"7ece924ee16eb27dfe123a921dd581c21cda3e12","user":{"login":"jennifercford","id":17389600,"avatar_url":"https://avatars.githubusercontent.com/u/17389600?v=3","gravatar_id":"","url":"https://api.github.com/users/jennifercford","html_url":"https://github.com/jennifercford","followers_url":"https://api.github.com/users/jennifercford/followers","following_url":"https://api.github.com/users/jennifercford/following{/other_user}","gists_url":"https://api.github.com/users/jennifercford/gists{/gist_id}","starred_url":"https://api.github.com/users/jennifercford/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jennifercford/subscriptions","organizations_url":"https://api.github.com/users/jennifercford/orgs","repos_url":"https://api.github.com/users/jennifercford/repos","events_url":"https://api.github.com/users/jennifercford/events{/privacy}","received_events_url":"https://api.github.com/users/jennifercford/received_events","type":"User","site_admin":false},"repo":{"id":56602090,"name":"planeswalkr","full_name":"jennifercford/planeswalkr","owner":{"login":"jennifercford","id":17389600,"avatar_url":"https://avatars.githubusercontent.com/u/17389600?v=3","gravatar_id":"","url":"https://api.github.com/users/jennifercford","html_url":"https://github.com/jennifercford","followers_url":"https://api.github.com/users/jennifercford/followers","following_url":"https://api.github.com/users/jennifercford/following{/other_user}","gists_url":"https://api.github.com/users/jennifercford/gists{/gist_id}","starred_url":"https://api.github.com/users/jennifercford/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jennifercford/subscriptions","organizations_url":"https://api.github.com/users/jennifercford/orgs","repos_url":"https://api.github.com/users/jennifercford/repos","events_url":"https://api.github.com/users/jennifercford/events{/privacy}","received_events_url":"https://api.github.com/users/jennifercford/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jennifercford/planeswalkr","description":"A Magic the Gathering deckbuilder","fork":true,"url":"https://api.github.com/repos/jennifercford/planeswalkr","forks_url":"https://api.github.com/repos/jennifercford/planeswalkr/forks","keys_url":"https://api.github.com/repos/jennifercford/planeswalkr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jennifercford/planeswalkr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jennifercford/planeswalkr/teams","hooks_url":"https://api.github.com/repos/jennifercford/planeswalkr/hooks","issue_events_url":"https://api.github.com/repos/jennifercford/planeswalkr/issues/events{/number}","events_url":"https://api.github.com/repos/jennifercford/planeswalkr/events","assignees_url":"https://api.github.com/repos/jennifercford/planeswalkr/assignees{/user}","branches_url":"https://api.github.com/repos/jennifercford/planeswalkr/branches{/branch}","tags_url":"https://api.github.com/repos/jennifercford/planeswalkr/tags","blobs_url":"https://api.github.com/repos/jennifercford/planeswalkr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jennifercford/planeswalkr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jennifercford/planeswalkr/git/refs{/sha}","trees_url":"https://api.github.com/repos/jennifercford/planeswalkr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jennifercford/planeswalkr/statuses/{sha}","languages_url":"https://api.github.com/repos/jennifercford/planeswalkr/languages","stargazers_url":"https://api.github.com/repos/jennifercford/planeswalkr/stargazers","contributors_url":"https://api.github.com/repos/jennifercford/planeswalkr/contributors","subscribers_url":"https://api.github.com/repos/jennifercford/planeswalkr/subscribers","subscription_url":"https://api.github.com/repos/jennifercford/planeswalkr/subscription","commits_url":"https://api.github.com/repos/jennifercford/planeswalkr/commits{/sha}","git_commits_url":"https://api.github.com/repos/jennifercford/planeswalkr/git/commits{/sha}","comments_url":"https://api.github.com/repos/jennifercford/planeswalkr/comments{/number}","issue_comment_url":"https://api.github.com/repos/jennifercford/planeswalkr/issues/comments{/number}","contents_url":"https://api.github.com/repos/jennifercford/planeswalkr/contents/{+path}","compare_url":"https://api.github.com/repos/jennifercford/planeswalkr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jennifercford/planeswalkr/merges","archive_url":"https://api.github.com/repos/jennifercford/planeswalkr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jennifercford/planeswalkr/downloads","issues_url":"https://api.github.com/repos/jennifercford/planeswalkr/issues{/number}","pulls_url":"https://api.github.com/repos/jennifercford/planeswalkr/pulls{/number}","milestones_url":"https://api.github.com/repos/jennifercford/planeswalkr/milestones{/number}","notifications_url":"https://api.github.com/repos/jennifercford/planeswalkr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jennifercford/planeswalkr/labels{/name}","releases_url":"https://api.github.com/repos/jennifercford/planeswalkr/releases{/id}","deployments_url":"https://api.github.com/repos/jennifercford/planeswalkr/deployments","created_at":"2016-04-19T14:05:59Z","updated_at":"2016-04-19T14:06:00Z","pushed_at":"2016-04-22T02:39:30Z","git_url":"git://github.com/jennifercford/planeswalkr.git","ssh_url":"git@github.com:jennifercford/planeswalkr.git","clone_url":"https://github.com/jennifercford/planeswalkr.git","svn_url":"https://github.com/jennifercford/planeswalkr","homepage":null,"size":91,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"TIY-ATL-ROR-2016-Feb:master","ref":"master","sha":"fe8b0a173ca206c216959349fe1981ac5dd2dfcb","user":{"login":"TIY-ATL-ROR-2016-Feb","id":16672577,"avatar_url":"https://avatars.githubusercontent.com/u/16672577?v=3","gravatar_id":"","url":"https://api.github.com/users/TIY-ATL-ROR-2016-Feb","html_url":"https://github.com/TIY-ATL-ROR-2016-Feb","followers_url":"https://api.github.com/users/TIY-ATL-ROR-2016-Feb/followers","following_url":"https://api.github.com/users/TIY-ATL-ROR-2016-Feb/following{/other_user}","gists_url":"https://api.github.com/users/TIY-ATL-ROR-2016-Feb/gists{/gist_id}","starred_url":"https://api.github.com/users/TIY-ATL-ROR-2016-Feb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TIY-ATL-ROR-2016-Feb/subscriptions","organizations_url":"https://api.github.com/users/TIY-ATL-ROR-2016-Feb/orgs","repos_url":"https://api.github.com/users/TIY-ATL-ROR-2016-Feb/repos","events_url":"https://api.github.com/users/TIY-ATL-ROR-2016-Feb/events{/privacy}","received_events_url":"https://api.github.com/users/TIY-ATL-ROR-2016-Feb/received_events","type":"Organization","site_admin":false},"repo":{"id":56514758,"name":"planeswalkr","full_name":"TIY-ATL-ROR-2016-Feb/planeswalkr","owner":{"login":"TIY-ATL-ROR-2016-Feb","id":16672577,"avatar_url":"https://avatars.githubusercontent.com/u/16672577?v=3","gravatar_id":"","url":"https://api.github.com/users/TIY-ATL-ROR-2016-Feb","html_url":"https://github.com/TIY-ATL-ROR-2016-Feb","followers_url":"https://api.github.com/users/TIY-ATL-ROR-2016-Feb/followers","following_url":"https://api.github.com/users/TIY-ATL-ROR-2016-Feb/following{/other_user}","gists_url":"https://api.github.com/users/TIY-ATL-ROR-2016-Feb/gists{/gist_id}","starred_url":"https://api.github.com/users/TIY-ATL-ROR-2016-Feb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TIY-ATL-ROR-2016-Feb/subscriptions","organizations_url":"https://api.github.com/users/TIY-ATL-ROR-2016-Feb/orgs","repos_url":"https://api.github.com/users/TIY-ATL-ROR-2016-Feb/repos","events_url":"https://api.github.com/users/TIY-ATL-ROR-2016-Feb/events{/privacy}","received_events_url":"https://api.github.com/users/TIY-ATL-ROR-2016-Feb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/TIY-ATL-ROR-2016-Feb/planeswalkr","description":"A Magic the Gathering deckbuilder","fork":false,"url":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr","forks_url":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/forks","keys_url":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/teams","hooks_url":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/hooks","issue_events_url":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/issues/events{/number}","events_url":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/events","assignees_url":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/assignees{/user}","branches_url":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/branches{/branch}","tags_url":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/tags","blobs_url":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/git/refs{/sha}","trees_url":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/statuses/{sha}","languages_url":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/languages","stargazers_url":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/stargazers","contributors_url":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/contributors","subscribers_url":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/subscribers","subscription_url":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/subscription","commits_url":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/commits{/sha}","git_commits_url":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/git/commits{/sha}","comments_url":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/comments{/number}","issue_comment_url":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/issues/comments{/number}","contents_url":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/contents/{+path}","compare_url":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/merges","archive_url":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/downloads","issues_url":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/issues{/number}","pulls_url":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/pulls{/number}","milestones_url":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/milestones{/number}","notifications_url":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/labels{/name}","releases_url":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/releases{/id}","deployments_url":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/deployments","created_at":"2016-04-18T14:29:10Z","updated_at":"2016-04-18T14:29:42Z","pushed_at":"2016-04-22T15:29:27Z","git_url":"git://github.com/TIY-ATL-ROR-2016-Feb/planeswalkr.git","ssh_url":"git@github.com:TIY-ATL-ROR-2016-Feb/planeswalkr.git","clone_url":"https://github.com/TIY-ATL-ROR-2016-Feb/planeswalkr.git","svn_url":"https://github.com/TIY-ATL-ROR-2016-Feb/planeswalkr","homepage":null,"size":123,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":13,"forks":8,"open_issues":13,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/pulls/49"},"html":{"href":"https://github.com/TIY-ATL-ROR-2016-Feb/planeswalkr/pull/49"},"issue":{"href":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/issues/49"},"comments":{"href":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/issues/49/comments"},"review_comments":{"href":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/pulls/49/comments"},"review_comment":{"href":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/pulls/49/commits"},"statuses":{"href":"https://api.github.com/repos/TIY-ATL-ROR-2016-Feb/planeswalkr/statuses/7ece924ee16eb27dfe123a921dd581c21cda3e12"}}}}