有没有一些简写方式来表示
@notifications = Notification.find(:all, :conditions => ['expires_at > ?', Time.now])
notif = Notification.find(:all, cookie[0].to_i)
@notifications.delete(notif[0]) if not notif.empty?
Cookie是存储在浏览器cookie中的通知ID。
这是一个迭代过程,它会删除用户不想看到的通知。
谢谢!=)