5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/flyer/controller_additions.rb', line 5
def notifications
@notifications ||= begin
found_notifications = []
Flyer::Notification.notifications.each do |n|
notification = Flyer::Notification.new(self)
n.call(notification)
notification.validate!
if notification.visible?
notification.used!
found_notifications << notification.view
end
end
ids = found_notifications.map(&:id)
unless ids.uniq.count == ids.count
raise Flyer::FoundNonUniqueIds.new
end
found_notifications
end
end
|