{"action":"created","comment":{"url":"https://api.github.com/repos/Ada-C4/MediaRanker/pulls/comments/46869729","id":46869729,"diff_hunk":"@@ -0,0 +1,59 @@\n+class AlbumsController < ApplicationController\n+\n+  def index\n+    @albums = Album.all\n+  end\n+\n+  def upvote\n+    @album = Album.find(params[:id])\n+    @album.update_attribute(:ranking, @album.ranking + 1)\n+    redirect_to action: :show\n+  end\n+\n+  def show\n+    @album = Album.find(params[:id])\n+  end\n+\n+  def new\n+    @album = Album.new\n+  end\n+\n+  def create\n+    @album = Album.create(title: album_params[:album][:title],\n+                 description: album_params[:album][:description],\n+                 artist: album_params[:album][:artist],\n+                 ranking: 0)\n+    if @album.save\n+      redirect_to album_path(@album.id)\n+    else\n+      render \"new\"\n+    end\n+  end\n+\n+  def edit\n+    id = params[:id]\n+    @album = Album.find(id)\n+  end\n+\n+  def update\n+    id = params[:id]\n+    @album = Album.find(id)\n+    if @album.update(album_params[:album])\n+      redirect_to album_path(@album.id)\n+    else\n+      render \"edit\"\n+    end\n+  end\n+\n+  def destroy\n+    id = params[:id]\n+    Album.destroy(id)\n+    redirect_to albums_path\n+  end\n+\n+  private\n+\n+  def album_params\n+    params.permit(album:[:title, :description, :ranking, :artist])","path":"app/controllers/albums_controller.rb","position":57,"original_position":57,"commit_id":"ccd4f0c2bce57c2953fd32ffbb324c0e6658f059","original_commit_id":"ccd4f0c2bce57c2953fd32ffbb324c0e6658f059","user":{"login":"Hamled","id":66355,"avatar_url":"https://avatars.githubusercontent.com/u/66355?v=3","gravatar_id":"","url":"https://api.github.com/users/Hamled","html_url":"https://github.com/Hamled","followers_url":"https://api.github.com/users/Hamled/followers","following_url":"https://api.github.com/users/Hamled/following{/other_user}","gists_url":"https://api.github.com/users/Hamled/gists{/gist_id}","starred_url":"https://api.github.com/users/Hamled/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hamled/subscriptions","organizations_url":"https://api.github.com/users/Hamled/orgs","repos_url":"https://api.github.com/users/Hamled/repos","events_url":"https://api.github.com/users/Hamled/events{/privacy}","received_events_url":"https://api.github.com/users/Hamled/received_events","type":"User","site_admin":false},"body":"If we change this line to:\r\n```ruby\r\nparams.require(:album).permit(:title, :description, :ranking, :artist)\r\n```\r\n\r\n... we get slightly more security (params must have a sub-hash called `:album` to be valid), and on lines 22 and 41 we can just say `Album.create(album_params)` or `@album.update(album_params)` and not need to specify the `:album` sub-hash (because Rails knows its required).","created_at":"2015-12-07T20:05:29Z","updated_at":"2015-12-07T20:05:29Z","html_url":"https://github.com/Ada-C4/MediaRanker/pull/28#discussion_r46869729","pull_request_url":"https://api.github.com/repos/Ada-C4/MediaRanker/pulls/28","_links":{"self":{"href":"https://api.github.com/repos/Ada-C4/MediaRanker/pulls/comments/46869729"},"html":{"href":"https://github.com/Ada-C4/MediaRanker/pull/28#discussion_r46869729"},"pull_request":{"href":"https://api.github.com/repos/Ada-C4/MediaRanker/pulls/28"}}},"pull_request":{"url":"https://api.github.com/repos/Ada-C4/MediaRanker/pulls/28","id":52706428,"html_url":"https://github.com/Ada-C4/MediaRanker/pull/28","diff_url":"https://github.com/Ada-C4/MediaRanker/pull/28.diff","patch_url":"https://github.com/Ada-C4/MediaRanker/pull/28.patch","issue_url":"https://api.github.com/repos/Ada-C4/MediaRanker/issues/28","number":28,"state":"open","locked":false,"title":"Audrey's final MediaRanker","user":{"login":"Dreedle","id":8892125,"avatar_url":"https://avatars.githubusercontent.com/u/8892125?v=3","gravatar_id":"","url":"https://api.github.com/users/Dreedle","html_url":"https://github.com/Dreedle","followers_url":"https://api.github.com/users/Dreedle/followers","following_url":"https://api.github.com/users/Dreedle/following{/other_user}","gists_url":"https://api.github.com/users/Dreedle/gists{/gist_id}","starred_url":"https://api.github.com/users/Dreedle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dreedle/subscriptions","organizations_url":"https://api.github.com/users/Dreedle/orgs","repos_url":"https://api.github.com/users/Dreedle/repos","events_url":"https://api.github.com/users/Dreedle/events{/privacy}","received_events_url":"https://api.github.com/users/Dreedle/received_events","type":"User","site_admin":false},"body":"Did accomplish:\r\n-The requirements for waves 1, 2 and 3.\r\n-98% code coverage on tests. (The model tests do not have complete coverage because I did not write a test for my method to order the items by ranking. I figured that method is entirely ActiveRecord, and I only wrote it to make the code in the views more concise.)\r\n-Using shared examples to do rspec tests. \r\n\r\nDid not accomplish:\r\n-Drying out views/controllers with polymorphic path. Once I had written the tests, I decided that ship had sailed. \r\n-On index page for books, albums and movie, the spacing of table rows look slightly different. Chalking it up to dynamicity of the table rows, but not entirely sure. Couldn't find a css difference.\r\n\r\n\r\n","created_at":"2015-12-04T18:52:20Z","updated_at":"2015-12-07T20:05:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e9ae117d34b7b8a46177a3a3eb4bc054103fbf68","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Ada-C4/MediaRanker/pulls/28/commits","review_comments_url":"https://api.github.com/repos/Ada-C4/MediaRanker/pulls/28/comments","review_comment_url":"https://api.github.com/repos/Ada-C4/MediaRanker/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Ada-C4/MediaRanker/issues/28/comments","statuses_url":"https://api.github.com/repos/Ada-C4/MediaRanker/statuses/ccd4f0c2bce57c2953fd32ffbb324c0e6658f059","head":{"label":"Dreedle:ald/master","ref":"ald/master","sha":"ccd4f0c2bce57c2953fd32ffbb324c0e6658f059","user":{"login":"Dreedle","id":8892125,"avatar_url":"https://avatars.githubusercontent.com/u/8892125?v=3","gravatar_id":"","url":"https://api.github.com/users/Dreedle","html_url":"https://github.com/Dreedle","followers_url":"https://api.github.com/users/Dreedle/followers","following_url":"https://api.github.com/users/Dreedle/following{/other_user}","gists_url":"https://api.github.com/users/Dreedle/gists{/gist_id}","starred_url":"https://api.github.com/users/Dreedle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dreedle/subscriptions","organizations_url":"https://api.github.com/users/Dreedle/orgs","repos_url":"https://api.github.com/users/Dreedle/repos","events_url":"https://api.github.com/users/Dreedle/events{/privacy}","received_events_url":"https://api.github.com/users/Dreedle/received_events","type":"User","site_admin":false},"repo":{"id":47141619,"name":"MediaRanker","full_name":"Dreedle/MediaRanker","owner":{"login":"Dreedle","id":8892125,"avatar_url":"https://avatars.githubusercontent.com/u/8892125?v=3","gravatar_id":"","url":"https://api.github.com/users/Dreedle","html_url":"https://github.com/Dreedle","followers_url":"https://api.github.com/users/Dreedle/followers","following_url":"https://api.github.com/users/Dreedle/following{/other_user}","gists_url":"https://api.github.com/users/Dreedle/gists{/gist_id}","starred_url":"https://api.github.com/users/Dreedle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dreedle/subscriptions","organizations_url":"https://api.github.com/users/Dreedle/orgs","repos_url":"https://api.github.com/users/Dreedle/repos","events_url":"https://api.github.com/users/Dreedle/events{/privacy}","received_events_url":"https://api.github.com/users/Dreedle/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Dreedle/MediaRanker","description":"","fork":true,"url":"https://api.github.com/repos/Dreedle/MediaRanker","forks_url":"https://api.github.com/repos/Dreedle/MediaRanker/forks","keys_url":"https://api.github.com/repos/Dreedle/MediaRanker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Dreedle/MediaRanker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Dreedle/MediaRanker/teams","hooks_url":"https://api.github.com/repos/Dreedle/MediaRanker/hooks","issue_events_url":"https://api.github.com/repos/Dreedle/MediaRanker/issues/events{/number}","events_url":"https://api.github.com/repos/Dreedle/MediaRanker/events","assignees_url":"https://api.github.com/repos/Dreedle/MediaRanker/assignees{/user}","branches_url":"https://api.github.com/repos/Dreedle/MediaRanker/branches{/branch}","tags_url":"https://api.github.com/repos/Dreedle/MediaRanker/tags","blobs_url":"https://api.github.com/repos/Dreedle/MediaRanker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Dreedle/MediaRanker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Dreedle/MediaRanker/git/refs{/sha}","trees_url":"https://api.github.com/repos/Dreedle/MediaRanker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Dreedle/MediaRanker/statuses/{sha}","languages_url":"https://api.github.com/repos/Dreedle/MediaRanker/languages","stargazers_url":"https://api.github.com/repos/Dreedle/MediaRanker/stargazers","contributors_url":"https://api.github.com/repos/Dreedle/MediaRanker/contributors","subscribers_url":"https://api.github.com/repos/Dreedle/MediaRanker/subscribers","subscription_url":"https://api.github.com/repos/Dreedle/MediaRanker/subscription","commits_url":"https://api.github.com/repos/Dreedle/MediaRanker/commits{/sha}","git_commits_url":"https://api.github.com/repos/Dreedle/MediaRanker/git/commits{/sha}","comments_url":"https://api.github.com/repos/Dreedle/MediaRanker/comments{/number}","issue_comment_url":"https://api.github.com/repos/Dreedle/MediaRanker/issues/comments{/number}","contents_url":"https://api.github.com/repos/Dreedle/MediaRanker/contents/{+path}","compare_url":"https://api.github.com/repos/Dreedle/MediaRanker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Dreedle/MediaRanker/merges","archive_url":"https://api.github.com/repos/Dreedle/MediaRanker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Dreedle/MediaRanker/downloads","issues_url":"https://api.github.com/repos/Dreedle/MediaRanker/issues{/number}","pulls_url":"https://api.github.com/repos/Dreedle/MediaRanker/pulls{/number}","milestones_url":"https://api.github.com/repos/Dreedle/MediaRanker/milestones{/number}","notifications_url":"https://api.github.com/repos/Dreedle/MediaRanker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Dreedle/MediaRanker/labels{/name}","releases_url":"https://api.github.com/repos/Dreedle/MediaRanker/releases{/id}","created_at":"2015-11-30T19:40:12Z","updated_at":"2015-11-17T19:05:01Z","pushed_at":"2015-12-04T18:38:08Z","git_url":"git://github.com/Dreedle/MediaRanker.git","ssh_url":"git@github.com:Dreedle/MediaRanker.git","clone_url":"https://github.com/Dreedle/MediaRanker.git","svn_url":"https://github.com/Dreedle/MediaRanker","homepage":null,"size":200,"stargazers_count":0,"watchers_count":0,"language":null,"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":"Ada-C4:ald/master","ref":"ald/master","sha":"a92fd730e6f62b182029d6a0e45fac3ff990f8c7","user":{"login":"Ada-C4","id":14096372,"avatar_url":"https://avatars.githubusercontent.com/u/14096372?v=3","gravatar_id":"","url":"https://api.github.com/users/Ada-C4","html_url":"https://github.com/Ada-C4","followers_url":"https://api.github.com/users/Ada-C4/followers","following_url":"https://api.github.com/users/Ada-C4/following{/other_user}","gists_url":"https://api.github.com/users/Ada-C4/gists{/gist_id}","starred_url":"https://api.github.com/users/Ada-C4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ada-C4/subscriptions","organizations_url":"https://api.github.com/users/Ada-C4/orgs","repos_url":"https://api.github.com/users/Ada-C4/repos","events_url":"https://api.github.com/users/Ada-C4/events{/privacy}","received_events_url":"https://api.github.com/users/Ada-C4/received_events","type":"Organization","site_admin":false},"repo":{"id":47089231,"name":"MediaRanker","full_name":"Ada-C4/MediaRanker","owner":{"login":"Ada-C4","id":14096372,"avatar_url":"https://avatars.githubusercontent.com/u/14096372?v=3","gravatar_id":"","url":"https://api.github.com/users/Ada-C4","html_url":"https://github.com/Ada-C4","followers_url":"https://api.github.com/users/Ada-C4/followers","following_url":"https://api.github.com/users/Ada-C4/following{/other_user}","gists_url":"https://api.github.com/users/Ada-C4/gists{/gist_id}","starred_url":"https://api.github.com/users/Ada-C4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ada-C4/subscriptions","organizations_url":"https://api.github.com/users/Ada-C4/orgs","repos_url":"https://api.github.com/users/Ada-C4/repos","events_url":"https://api.github.com/users/Ada-C4/events{/privacy}","received_events_url":"https://api.github.com/users/Ada-C4/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Ada-C4/MediaRanker","description":"","fork":true,"url":"https://api.github.com/repos/Ada-C4/MediaRanker","forks_url":"https://api.github.com/repos/Ada-C4/MediaRanker/forks","keys_url":"https://api.github.com/repos/Ada-C4/MediaRanker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Ada-C4/MediaRanker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Ada-C4/MediaRanker/teams","hooks_url":"https://api.github.com/repos/Ada-C4/MediaRanker/hooks","issue_events_url":"https://api.github.com/repos/Ada-C4/MediaRanker/issues/events{/number}","events_url":"https://api.github.com/repos/Ada-C4/MediaRanker/events","assignees_url":"https://api.github.com/repos/Ada-C4/MediaRanker/assignees{/user}","branches_url":"https://api.github.com/repos/Ada-C4/MediaRanker/branches{/branch}","tags_url":"https://api.github.com/repos/Ada-C4/MediaRanker/tags","blobs_url":"https://api.github.com/repos/Ada-C4/MediaRanker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Ada-C4/MediaRanker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Ada-C4/MediaRanker/git/refs{/sha}","trees_url":"https://api.github.com/repos/Ada-C4/MediaRanker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Ada-C4/MediaRanker/statuses/{sha}","languages_url":"https://api.github.com/repos/Ada-C4/MediaRanker/languages","stargazers_url":"https://api.github.com/repos/Ada-C4/MediaRanker/stargazers","contributors_url":"https://api.github.com/repos/Ada-C4/MediaRanker/contributors","subscribers_url":"https://api.github.com/repos/Ada-C4/MediaRanker/subscribers","subscription_url":"https://api.github.com/repos/Ada-C4/MediaRanker/subscription","commits_url":"https://api.github.com/repos/Ada-C4/MediaRanker/commits{/sha}","git_commits_url":"https://api.github.com/repos/Ada-C4/MediaRanker/git/commits{/sha}","comments_url":"https://api.github.com/repos/Ada-C4/MediaRanker/comments{/number}","issue_comment_url":"https://api.github.com/repos/Ada-C4/MediaRanker/issues/comments{/number}","contents_url":"https://api.github.com/repos/Ada-C4/MediaRanker/contents/{+path}","compare_url":"https://api.github.com/repos/Ada-C4/MediaRanker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Ada-C4/MediaRanker/merges","archive_url":"https://api.github.com/repos/Ada-C4/MediaRanker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Ada-C4/MediaRanker/downloads","issues_url":"https://api.github.com/repos/Ada-C4/MediaRanker/issues{/number}","pulls_url":"https://api.github.com/repos/Ada-C4/MediaRanker/pulls{/number}","milestones_url":"https://api.github.com/repos/Ada-C4/MediaRanker/milestones{/number}","notifications_url":"https://api.github.com/repos/Ada-C4/MediaRanker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Ada-C4/MediaRanker/labels{/name}","releases_url":"https://api.github.com/repos/Ada-C4/MediaRanker/releases{/id}","created_at":"2015-11-30T01:55:13Z","updated_at":"2015-11-17T19:05:01Z","pushed_at":"2015-12-06T20:37:11Z","git_url":"git://github.com/Ada-C4/MediaRanker.git","ssh_url":"git@github.com:Ada-C4/MediaRanker.git","clone_url":"https://github.com/Ada-C4/MediaRanker.git","svn_url":"https://github.com/Ada-C4/MediaRanker","homepage":null,"size":1609,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":22,"mirror_url":null,"open_issues_count":22,"forks":22,"open_issues":22,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Ada-C4/MediaRanker/pulls/28"},"html":{"href":"https://github.com/Ada-C4/MediaRanker/pull/28"},"issue":{"href":"https://api.github.com/repos/Ada-C4/MediaRanker/issues/28"},"comments":{"href":"https://api.github.com/repos/Ada-C4/MediaRanker/issues/28/comments"},"review_comments":{"href":"https://api.github.com/repos/Ada-C4/MediaRanker/pulls/28/comments"},"review_comment":{"href":"https://api.github.com/repos/Ada-C4/MediaRanker/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Ada-C4/MediaRanker/pulls/28/commits"},"statuses":{"href":"https://api.github.com/repos/Ada-C4/MediaRanker/statuses/ccd4f0c2bce57c2953fd32ffbb324c0e6658f059"}}}}