user page doesn't give an error anymore. fixed visible_person_by_id to return self.person instead of self

This commit is contained in:
danielvincent 2010-08-18 02:32:31 -07:00
parent 539316a235
commit 2409fd3f20
3 changed files with 12 additions and 13 deletions

View file

@ -12,12 +12,11 @@ class PeopleController < ApplicationController
end
def show
@person= current_user.visible_person_by_id(params[:id])
@person_profile = @person.profile
@person_posts = Post.where(:person_id => @person.id).paginate :page => params[:page], :order => 'created_at DESC'
@person = current_user.visible_person_by_id(params[:id])
@profile = @person.profile
@posts = Post.find_all_by_person_id(@person.id).paginate :page => params[:page], :order => 'created_at DESC'
@latest_status_message = StatusMessage.newest_for(@person)
@post_count = @person_posts.count
@post_count = @posts.count
end
def destroy

View file

@ -281,7 +281,7 @@ class User
end
def visible_person_by_id( id )
return self if id == self.id
return self.person if ensure_bson(id) == self.person.id
friends.detect{|x| x.id == ensure_bson( id ) }
end

View file

@ -6,13 +6,13 @@
%h1
= @person.real_name
- unless @person.id == current_user.id
.button.right
= link_to 'remove friend', @person, :confirm => 'Are you sure?', :method => :delete
.right
= link_to 'remove friend', @person, :confirm => 'Are you sure?', :method => :delete, :class => "button"
%ul
-unless @person_posts.first.nil?
-unless @posts.first.nil?
%li
%i= "last seen: #{how_long_ago(@person_posts.first)}"
%i= "last seen: #{how_long_ago(@posts.first)}"
%li
%i= "friends since: #{how_long_ago(@person)}"
%li
@ -26,11 +26,11 @@
%span="posted: #{how_long_ago(@latest_status_message)}"
.span-20.last
- if @person.posts
- if @posts
%h3= "stream - #{@post_count} item(s)"
%ul#stream
- for post in @person_posts
- for post in @posts
= render type_partial(post), :post => post
= will_paginate @person_posts
= will_paginate @posts
- else
%h3 no posts to display!