Explorar el Código

Scope notifications controller to the current user

Chris Oliver hace 7 años
padre
commit
dcd6ae54a5
Se han modificado 1 ficheros con 1 adiciones y 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