Explorar o código

Scope notifications controller to the current user

Chris Oliver %!s(int64=6) %!d(string=hai) anos
pai
achega
dcd6ae54a5
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      app/controllers/notifications_controller.rb

+ 1 - 1
app/controllers/notifications_controller.rb

@@ -2,6 +2,6 @@ class NotificationsController < ApplicationController
   before_action :authenticate_user!
 
   def index
-    @notifications = Notification.where(recipient: current_user)
+    @notifications = current_user.notifications
   end
 end