{"action":"opened","issue":{"url":"https://api.github.com/repos/Caleb9193/gif-generator/issues/1","repository_url":"https://api.github.com/repos/Caleb9193/gif-generator","labels_url":"https://api.github.com/repos/Caleb9193/gif-generator/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/Caleb9193/gif-generator/issues/1/comments","events_url":"https://api.github.com/repos/Caleb9193/gif-generator/issues/1/events","html_url":"https://github.com/Caleb9193/gif-generator/issues/1","id":167474442,"number":1,"title":"Feedback","user":{"login":"case-eee","id":6503717,"avatar_url":"https://avatars.githubusercontent.com/u/6503717?v=3","gravatar_id":"","url":"https://api.github.com/users/case-eee","html_url":"https://github.com/case-eee","followers_url":"https://api.github.com/users/case-eee/followers","following_url":"https://api.github.com/users/case-eee/following{/other_user}","gists_url":"https://api.github.com/users/case-eee/gists{/gist_id}","starred_url":"https://api.github.com/users/case-eee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/case-eee/subscriptions","organizations_url":"https://api.github.com/users/case-eee/orgs","repos_url":"https://api.github.com/users/case-eee/repos","events_url":"https://api.github.com/users/case-eee/events{/privacy}","received_events_url":"https://api.github.com/users/case-eee/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-07-25T21:50:26Z","updated_at":"2016-07-25T21:50:26Z","closed_at":null,"body":"@Caleb9193 \r\n\r\n1. What happens in this action if this favorite gif already exists? Be sure you are accounting for if things already exist or fail validations!\r\n```\r\n# gif_controller.rb\r\n  def create\r\n    gif = Gif.find(params[:format])\r\n    current_user.gifs << gif\r\n    redirect_to user_path(current_user)\r\n  end\r\n```\r\nSame with this method:\r\n```\r\n# admin/categories_controller.rb\r\n  def create\r\n    category = Category.find_or_create_by(name:params[:category][:name])\r\n    gif = category.gifs.create(name:category.name, image_path:find_url(category.name))\r\n    redirect_to admin_category_path(category)\r\n  end\r\n```\r\n2. There's an ActiveRecord method called `dependent: :destroy`.  This may help clean up the need to find the category, delete all the category's gifs, then delete the category like you're doing here:\r\n```\r\n# admin/categories_controller.rb\r\ncategory = Category.find(params[:id])\r\ncategory.gifs.delete_all\r\ncategory.destroy\r\n```\r\nSame goes when you're deleting gif's!\r\n3. I don't see many validations. You'll want to add more of these to ensure that you only have quality data in your database.\r\n4. Both of your `admin/categories/index.html.erb` and `categories/index.html.erb` look incredibly similar. Excellent time for a partial!\r\n5. This logic (in your dashboard index) should live in a helper: `unless current_user || current_admin?`. Whenever you find yourself doing `&&` or `||` or `>` etc, you should create a new method that handles that logic.  \r\n\r\nOverall, your code looks solid. I didn't go into every single line of code, but I did glance through most of it. If you have questions about any of my comments, let me know!"}}
{"actor":{"display_login":"case-eee"}}