{"action":"created","comment":{"url":"https://api.github.com/repos/nastyastavitskaya/flashcards/pulls/comments/43981969","id":43981969,"diff_hunk":"@@ -1,64 +1,64 @@\n class CardsController < ApplicationController\n-  before_action :find_card,\n-                only: [:show, :edit, :update, :destroy]\n-  before_action :require_login\n-\n+  before_action :find_category\n \n   def index\n-    @cards = current_user.cards.all\n   end\n \n \n   def show\n+    @card = @category.cards.find(params[:id])\n   end\n \n \n   def new\n-    @card = current_user.cards.new\n-  end\n-\n-  def edit\n+    @card = @category.cards.new\n   end\n \n   def create\n-    @card = current_user.cards.new(card_params)\n-\n+    @card = @category.cards.new(card_params)\n     if @card.save\n-      redirect_to @card\n+      flash[:success] = \"Added card.\"\n+      redirect_to category_cards_path\n     else\n+      flash[:danger] = \"There was a problem adding that card.\"\n       render 'new'\n     end\n   end\n \n+  def edit\n+    @card = @category.cards.find(params[:id])\n+  end\n+\n   def update\n-    if @card.update(card_params)\n-      redirect_to @card\n-      flash[:success] = \"Successfully updated card.\"\n+     @card = @category.cards.find(params[:id])\n+    if @card.update_attributes(card_params)\n+      flash[:success] = \"Saved card.\"\n+      redirect_to category_cards_path\n     else\n+      flash[:error] = \"That card could not be saved.\"\n       render 'edit'\n     end\n   end\n \n   def destroy\n+    @card = @category.cards.find(params[:id])\n     @card.destroy\n     flash[:danger] = \"Card deleted.\"\n-    redirect_to cards_path\n+    redirect_to category_cards_path\n   end\n \n-  private\n-\n-  def card_params\n-    params.require(:card).permit(:original_text, :translated_text, :review_date, :image)\n+  def url_options\n+    { category_id: params[:category_id] }.merge(super)\n   end","path":"app/controllers/cards_controller.rb","position":72,"original_position":72,"commit_id":"6391651bef2c1e38dc9ee5e5d49b2c92d2a1875d","original_commit_id":"be146d1e2e7c2e703d78a494a723438a51075987","user":{"login":"mkdev-mentor-1","id":11962702,"avatar_url":"https://avatars.githubusercontent.com/u/11962702?v=3","gravatar_id":"","url":"https://api.github.com/users/mkdev-mentor-1","html_url":"https://github.com/mkdev-mentor-1","followers_url":"https://api.github.com/users/mkdev-mentor-1/followers","following_url":"https://api.github.com/users/mkdev-mentor-1/following{/other_user}","gists_url":"https://api.github.com/users/mkdev-mentor-1/gists{/gist_id}","starred_url":"https://api.github.com/users/mkdev-mentor-1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkdev-mentor-1/subscriptions","organizations_url":"https://api.github.com/users/mkdev-mentor-1/orgs","repos_url":"https://api.github.com/users/mkdev-mentor-1/repos","events_url":"https://api.github.com/users/mkdev-mentor-1/events{/privacy}","received_events_url":"https://api.github.com/users/mkdev-mentor-1/received_events","type":"User","site_admin":false},"body":"Вопросы игнорировать не рекомендую, я их не из праздного любопытства же задаю. Жду ответа в гитере","created_at":"2015-11-05T07:07:48Z","updated_at":"2015-11-05T07:07:48Z","html_url":"https://github.com/nastyastavitskaya/flashcards/pull/12#discussion_r43981969","pull_request_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/pulls/12","_links":{"self":{"href":"https://api.github.com/repos/nastyastavitskaya/flashcards/pulls/comments/43981969"},"html":{"href":"https://github.com/nastyastavitskaya/flashcards/pull/12#discussion_r43981969"},"pull_request":{"href":"https://api.github.com/repos/nastyastavitskaya/flashcards/pulls/12"}}},"pull_request":{"url":"https://api.github.com/repos/nastyastavitskaya/flashcards/pulls/12","id":49219851,"html_url":"https://github.com/nastyastavitskaya/flashcards/pull/12","diff_url":"https://github.com/nastyastavitskaya/flashcards/pull/12.diff","patch_url":"https://github.com/nastyastavitskaya/flashcards/pull/12.patch","issue_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/issues/12","number":12,"state":"open","locked":false,"title":"Eleventh task","user":{"login":"nastyastavitskaya","id":12608980,"avatar_url":"https://avatars.githubusercontent.com/u/12608980?v=3","gravatar_id":"","url":"https://api.github.com/users/nastyastavitskaya","html_url":"https://github.com/nastyastavitskaya","followers_url":"https://api.github.com/users/nastyastavitskaya/followers","following_url":"https://api.github.com/users/nastyastavitskaya/following{/other_user}","gists_url":"https://api.github.com/users/nastyastavitskaya/gists{/gist_id}","starred_url":"https://api.github.com/users/nastyastavitskaya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nastyastavitskaya/subscriptions","organizations_url":"https://api.github.com/users/nastyastavitskaya/orgs","repos_url":"https://api.github.com/users/nastyastavitskaya/repos","events_url":"https://api.github.com/users/nastyastavitskaya/events{/privacy}","received_events_url":"https://api.github.com/users/nastyastavitskaya/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-10-30T00:51:27Z","updated_at":"2015-11-05T07:07:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e2b510765ae1bf95a00ce2990380b28f104ef81e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/pulls/12/commits","review_comments_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/pulls/12/comments","review_comment_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/issues/12/comments","statuses_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/statuses/6391651bef2c1e38dc9ee5e5d49b2c92d2a1875d","head":{"label":"nastyastavitskaya:eleventh-task","ref":"eleventh-task","sha":"6391651bef2c1e38dc9ee5e5d49b2c92d2a1875d","user":{"login":"nastyastavitskaya","id":12608980,"avatar_url":"https://avatars.githubusercontent.com/u/12608980?v=3","gravatar_id":"","url":"https://api.github.com/users/nastyastavitskaya","html_url":"https://github.com/nastyastavitskaya","followers_url":"https://api.github.com/users/nastyastavitskaya/followers","following_url":"https://api.github.com/users/nastyastavitskaya/following{/other_user}","gists_url":"https://api.github.com/users/nastyastavitskaya/gists{/gist_id}","starred_url":"https://api.github.com/users/nastyastavitskaya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nastyastavitskaya/subscriptions","organizations_url":"https://api.github.com/users/nastyastavitskaya/orgs","repos_url":"https://api.github.com/users/nastyastavitskaya/repos","events_url":"https://api.github.com/users/nastyastavitskaya/events{/privacy}","received_events_url":"https://api.github.com/users/nastyastavitskaya/received_events","type":"User","site_admin":false},"repo":{"id":36800698,"name":"flashcards","full_name":"nastyastavitskaya/flashcards","owner":{"login":"nastyastavitskaya","id":12608980,"avatar_url":"https://avatars.githubusercontent.com/u/12608980?v=3","gravatar_id":"","url":"https://api.github.com/users/nastyastavitskaya","html_url":"https://github.com/nastyastavitskaya","followers_url":"https://api.github.com/users/nastyastavitskaya/followers","following_url":"https://api.github.com/users/nastyastavitskaya/following{/other_user}","gists_url":"https://api.github.com/users/nastyastavitskaya/gists{/gist_id}","starred_url":"https://api.github.com/users/nastyastavitskaya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nastyastavitskaya/subscriptions","organizations_url":"https://api.github.com/users/nastyastavitskaya/orgs","repos_url":"https://api.github.com/users/nastyastavitskaya/repos","events_url":"https://api.github.com/users/nastyastavitskaya/events{/privacy}","received_events_url":"https://api.github.com/users/nastyastavitskaya/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nastyastavitskaya/flashcards","description":"","fork":false,"url":"https://api.github.com/repos/nastyastavitskaya/flashcards","forks_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/forks","keys_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/teams","hooks_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/hooks","issue_events_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/issues/events{/number}","events_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/events","assignees_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/assignees{/user}","branches_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/branches{/branch}","tags_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/tags","blobs_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/git/refs{/sha}","trees_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/statuses/{sha}","languages_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/languages","stargazers_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/stargazers","contributors_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/contributors","subscribers_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/subscribers","subscription_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/subscription","commits_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/commits{/sha}","git_commits_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/git/commits{/sha}","comments_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/comments{/number}","issue_comment_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/issues/comments{/number}","contents_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/contents/{+path}","compare_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/merges","archive_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/downloads","issues_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/issues{/number}","pulls_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/pulls{/number}","milestones_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/milestones{/number}","notifications_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/labels{/name}","releases_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/releases{/id}","created_at":"2015-06-03T11:58:44Z","updated_at":"2015-06-03T12:47:21Z","pushed_at":"2015-11-05T00:53:15Z","git_url":"git://github.com/nastyastavitskaya/flashcards.git","ssh_url":"git@github.com:nastyastavitskaya/flashcards.git","clone_url":"https://github.com/nastyastavitskaya/flashcards.git","svn_url":"https://github.com/nastyastavitskaya/flashcards","homepage":null,"size":520,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"nastyastavitskaya:master","ref":"master","sha":"e4926acdec86207114b8ed7d341f83cddb314910","user":{"login":"nastyastavitskaya","id":12608980,"avatar_url":"https://avatars.githubusercontent.com/u/12608980?v=3","gravatar_id":"","url":"https://api.github.com/users/nastyastavitskaya","html_url":"https://github.com/nastyastavitskaya","followers_url":"https://api.github.com/users/nastyastavitskaya/followers","following_url":"https://api.github.com/users/nastyastavitskaya/following{/other_user}","gists_url":"https://api.github.com/users/nastyastavitskaya/gists{/gist_id}","starred_url":"https://api.github.com/users/nastyastavitskaya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nastyastavitskaya/subscriptions","organizations_url":"https://api.github.com/users/nastyastavitskaya/orgs","repos_url":"https://api.github.com/users/nastyastavitskaya/repos","events_url":"https://api.github.com/users/nastyastavitskaya/events{/privacy}","received_events_url":"https://api.github.com/users/nastyastavitskaya/received_events","type":"User","site_admin":false},"repo":{"id":36800698,"name":"flashcards","full_name":"nastyastavitskaya/flashcards","owner":{"login":"nastyastavitskaya","id":12608980,"avatar_url":"https://avatars.githubusercontent.com/u/12608980?v=3","gravatar_id":"","url":"https://api.github.com/users/nastyastavitskaya","html_url":"https://github.com/nastyastavitskaya","followers_url":"https://api.github.com/users/nastyastavitskaya/followers","following_url":"https://api.github.com/users/nastyastavitskaya/following{/other_user}","gists_url":"https://api.github.com/users/nastyastavitskaya/gists{/gist_id}","starred_url":"https://api.github.com/users/nastyastavitskaya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nastyastavitskaya/subscriptions","organizations_url":"https://api.github.com/users/nastyastavitskaya/orgs","repos_url":"https://api.github.com/users/nastyastavitskaya/repos","events_url":"https://api.github.com/users/nastyastavitskaya/events{/privacy}","received_events_url":"https://api.github.com/users/nastyastavitskaya/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nastyastavitskaya/flashcards","description":"","fork":false,"url":"https://api.github.com/repos/nastyastavitskaya/flashcards","forks_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/forks","keys_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/teams","hooks_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/hooks","issue_events_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/issues/events{/number}","events_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/events","assignees_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/assignees{/user}","branches_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/branches{/branch}","tags_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/tags","blobs_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/git/refs{/sha}","trees_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/statuses/{sha}","languages_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/languages","stargazers_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/stargazers","contributors_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/contributors","subscribers_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/subscribers","subscription_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/subscription","commits_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/commits{/sha}","git_commits_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/git/commits{/sha}","comments_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/comments{/number}","issue_comment_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/issues/comments{/number}","contents_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/contents/{+path}","compare_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/merges","archive_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/downloads","issues_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/issues{/number}","pulls_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/pulls{/number}","milestones_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/milestones{/number}","notifications_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/labels{/name}","releases_url":"https://api.github.com/repos/nastyastavitskaya/flashcards/releases{/id}","created_at":"2015-06-03T11:58:44Z","updated_at":"2015-06-03T12:47:21Z","pushed_at":"2015-11-05T00:53:15Z","git_url":"git://github.com/nastyastavitskaya/flashcards.git","ssh_url":"git@github.com:nastyastavitskaya/flashcards.git","clone_url":"https://github.com/nastyastavitskaya/flashcards.git","svn_url":"https://github.com/nastyastavitskaya/flashcards","homepage":null,"size":520,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nastyastavitskaya/flashcards/pulls/12"},"html":{"href":"https://github.com/nastyastavitskaya/flashcards/pull/12"},"issue":{"href":"https://api.github.com/repos/nastyastavitskaya/flashcards/issues/12"},"comments":{"href":"https://api.github.com/repos/nastyastavitskaya/flashcards/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/nastyastavitskaya/flashcards/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/nastyastavitskaya/flashcards/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nastyastavitskaya/flashcards/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/nastyastavitskaya/flashcards/statuses/6391651bef2c1e38dc9ee5e5d49b2c92d2a1875d"}}}}