| Class | Notification |
| In: |
app/models/notification.rb
|
| Parent: | ActiveRecord::Base |
# File app/models/notification.rb, line 26
26: def self.find_all_users(page, class_name)
27: Notification.find(:all, :conditions => ["page_id=? and notification_type=?", page.id, class_name]).collect {|n|n.user}
28: end
# File app/models/notification.rb, line 30
30: def self.find_or_create(page, user, class_name)
31: logger.info("Finding or creating notification for #{user.name} for #{page.presentation_name} and type #{class_name}")
32: n = Notification.find(:first, :conditions => ['page_id=? and notification_type=? and user_id=?',page.id, class_name, user.id])
33: if n.nil?
34: logger.info("No")
35: n = Notification.create(:notification_type => class_name, :user => user, :page => page)
36: end
37: return n
38: end