Hello all! In app/models/photo.rb, these Active Record calls:
def previous_photo self.user.photos.find(:first, :conditions => ['created_at < ?', created_at], :order => 'created_at DESC') end def next_photo self.user.photos.find(:first, :conditions => ['created_at > ?', created_at], :order => 'created_at ASC') end def previous_in_album return nil unless self.album self.user.photos.find(:first, :conditions => ['created_at < ? and album_id = ?', created_at, self.album.id], :order => 'created_at DESC') end def next_in_album return nil unless self.album self.user.photos.find(:first, :conditions => ['created_at > ? and album_id = ?', created_at, self.album_id], :order => 'created_at ASC') end ..have their order params clobbered by an preceding 'order by created_at DESC', which is inserted because of this association in the user model: has_many :photos, :order => "created_at desc" find(:first) is also deprecated. The fix: def previous_photo self.user.photos.where('created_at < ?', created_at).first end def next_photo self.user.photos.where('created_at > ?', created_at).last end def previous_in_album return nil unless self.album self.user.photos.where('created_at < ? and album_id = ?', created_at, self.album.id).first end def next_in_album return nil unless self.album self.user.photos.where('created_at > ? and album_id = ?', created_at, self.album_id).last end Onward! Mike -- You received this message because you are subscribed to the Google Groups "CommunityEngine" group. To post to this group, send email to communityengine@googlegroups.com. To unsubscribe from this group, send email to communityengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/communityengine?hl=en.