/
LizaLev
/
AcademyHomework
Обзор
Документация
Войти
/
LizaLev
/
AcademyHomework
Код
Запросы
3
Задачи
Пакеты
0
Релизы
0
Аналитика
Безопасность
course_project
CourseProject/app/controllers/comment_likes_controller.rb
15 строк
483 B
EarllGrayy
Добавить выполнение курсового проекта
18 окт 2024, 14:05
18 окт 2024, 14:05
3e01177
Код
Авторство
О чём код?
class CommentLikesController < ApplicationController before_action :authenticate_user! def create @comment = Comment.find(params[:comment_id]) @comment.likes.create(user: current_user) redirect_to post_path(@comment.post), notice: "You liked the comment." end def destroy @comment = Comment.find(params[:comment_id]) @comment.likes.find_by(user: current_user).destroy redirect_to post_path(@comment.post), notice: "You liked the comment." end end