dawarich/app/controllers/notifications_controller.rb

24 lines
557 B
Ruby
Raw Normal View History

2024-07-04 16:20:12 -04:00
# frozen_string_literal: true
class NotificationsController < ApplicationController
before_action :authenticate_user!
before_action :set_notification, only: %i[show destroy]
def index
@notifications = current_user.notifications.paginate(page: params[:page], per_page: 25)
end
def show; end
def destroy
@notification.destroy!
redirect_to notifications_url, notice: 'Notification was successfully destroyed.', status: :see_other
end
private
def set_notification
@notification = Notification.find(params[:id])
end
end