From 5afaef427ca0a60c39e238a7b8d0ce6dfed991e0 Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Sun, 29 Oct 2023 21:24:52 +0100 Subject: [PATCH] Rename `CommentController` to `CommentsController` --- .../{comment_controller.rb => comments_controller.rb} | 2 +- app/views/{comment => comments}/index.html.haml | 0 app/views/{comment => comments}/show_reactions.html.haml | 0 config/routes.rb | 4 ++-- ...comment_controller_spec.rb => comments_controller_spec.rb} | 2 +- 5 files changed, 4 insertions(+), 4 deletions(-) rename app/controllers/{comment_controller.rb => comments_controller.rb} (91%) rename app/views/{comment => comments}/index.html.haml (100%) rename app/views/{comment => comments}/show_reactions.html.haml (100%) rename spec/controllers/{comment_controller_spec.rb => comments_controller_spec.rb} (97%) diff --git a/app/controllers/comment_controller.rb b/app/controllers/comments_controller.rb similarity index 91% rename from app/controllers/comment_controller.rb rename to app/controllers/comments_controller.rb index b3e12514..4aa92962 100644 --- a/app/controllers/comment_controller.rb +++ b/app/controllers/comments_controller.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class CommentController < ApplicationController +class CommentsController < ApplicationController def index answer = Answer.find(params[:id]) @comments = Comment.where(answer:).includes([{ user: :profile }, :smiles]) diff --git a/app/views/comment/index.html.haml b/app/views/comments/index.html.haml similarity index 100% rename from app/views/comment/index.html.haml rename to app/views/comments/index.html.haml diff --git a/app/views/comment/show_reactions.html.haml b/app/views/comments/show_reactions.html.haml similarity index 100% rename from app/views/comment/show_reactions.html.haml rename to app/views/comments/show_reactions.html.haml diff --git a/config/routes.rb b/config/routes.rb index 7e5e259c..dde406e3 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -154,10 +154,10 @@ Rails.application.routes.draw do get "/@:username/a/:id", to: "answer#show", as: :answer post "/@:username/a/:id/pin", to: "answer#pin", as: :pin_answer delete "/@:username/a/:id/pin", to: "answer#unpin", as: :unpin_answer - get "/@:username/a/:id/comments", to: "comment#index", as: :comments + get "/@:username/a/:id/comments", to: "comments#index", as: :comments get "/@:username/a/:id/reactions", to: "reaction#index", as: :reactions get "/@:username/q/:id", to: "question#show", as: :question - get "/@:username/c/:id/reactions", to: "comment#show_reactions", as: :comment_reactions + get "/@:username/c/:id/reactions", to: "comments#show_reactions", as: :comment_reactions get "/@:username/followers", to: "user#followers", as: :show_user_followers get "/@:username/followings", to: "user#followings", as: :show_user_followings get "/@:username/friends", to: redirect("/@%{username}/followings") diff --git a/spec/controllers/comment_controller_spec.rb b/spec/controllers/comments_controller_spec.rb similarity index 97% rename from spec/controllers/comment_controller_spec.rb rename to spec/controllers/comments_controller_spec.rb index 63812485..1140f1f3 100644 --- a/spec/controllers/comment_controller_spec.rb +++ b/spec/controllers/comments_controller_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -describe CommentController, type: :controller do +describe CommentsController, type: :controller do describe "#index" do shared_examples_for "succeeds" do it "returns the correct response" do