From 5763b441bea1c1f9d1e531b81cc14c22543d3cdd Mon Sep 17 00:00:00 2001 From: maxwell Date: Fri, 17 Dec 2010 11:37:33 -0800 Subject: [PATCH] fixing order of Notification.for --- app/controllers/application_controller.rb | 2 +- app/models/notification.rb | 2 +- app/views/notifications/index.html.haml | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index bae611e4d..6ead92dec 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -17,7 +17,7 @@ class ApplicationController < ActionController::Base @aspect = nil @aspects = current_user.aspects.fields(:name) @aspects_dropdown_array = @aspects.collect{|x| [x.to_s, x.id]} - @notifications = Notification.for(current_user).limit(25).all + @notifications = Notification.for(current_user).all end end diff --git a/app/models/notification.rb b/app/models/notification.rb index 3b24dc4fa..ab77b24b8 100644 --- a/app/models/notification.rb +++ b/app/models/notification.rb @@ -16,7 +16,7 @@ class Notification attr_accessible :object_id, :kind, :user_id, :person_id def self.for(user, opts={}) - self.where(opts.merge(:user_id => user.id)) + self.where(opts.merge(:user_id => user.id)).order('created_at desc') end def self.notify(user, object, person) diff --git a/app/views/notifications/index.html.haml b/app/views/notifications/index.html.haml index 6daf43675..a7a4b2056 100644 --- a/app/views/notifications/index.html.haml +++ b/app/views/notifications/index.html.haml @@ -1,8 +1,8 @@ %ul + - @notifications.each do |note| - %h2= Date.parse(note.created_at.to_s) %li %h3 = link_to "#{note.person.name.titleize}", person_path(note.person) = object_link(note) - %span.description= time_ago_in_words(note.created_at) + %span.description=" #{time_ago_in_words(note.created_at)}"