나는 Notification
모델을 가지고 있는데 그 중 하나가 많은 열이 "읽지 않음"입니다.레일에서 ActiverRecord 컬렉션 필터링하기
간단한 방법을 사용하여 "읽지 않은"값이 false 인 레코드를 @notification 컬렉션에서 찾아야합니다. 예 :
@notifications= Notification.all
@notifications.unread --> returns a subset of @notifications which are unread
@notifications.unread.count --> returns number of unread notifications
이 "읽지 않은"방법을 어떻게 만듭니 까?
이것은 정확히 내가 원했던 것입니다. 감사. –