fixing order of Notification.for

This commit is contained in:
maxwell 2010-12-17 11:37:33 -08:00
parent 39deac62fb
commit 5763b441be
3 changed files with 4 additions and 4 deletions

View file

@ -17,7 +17,7 @@ class ApplicationController < ActionController::Base
@aspect = nil @aspect = nil
@aspects = current_user.aspects.fields(:name) @aspects = current_user.aspects.fields(:name)
@aspects_dropdown_array = @aspects.collect{|x| [x.to_s, x.id]} @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
end end

View file

@ -16,7 +16,7 @@ class Notification
attr_accessible :object_id, :kind, :user_id, :person_id attr_accessible :object_id, :kind, :user_id, :person_id
def self.for(user, opts={}) 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 end
def self.notify(user, object, person) def self.notify(user, object, person)

View file

@ -1,8 +1,8 @@
%ul %ul
- @notifications.each do |note| - @notifications.each do |note|
%h2= Date.parse(note.created_at.to_s)
%li %li
%h3 %h3
= link_to "#{note.person.name.titleize}", person_path(note.person) = link_to "#{note.person.name.titleize}", person_path(note.person)
= object_link(note) = object_link(note)
%span.description= time_ago_in_words(note.created_at) %span.description=" #{time_ago_in_words(note.created_at)}"