From 23057869e1f1a3dda13475f0b3f362f7f3df8a85 Mon Sep 17 00:00:00 2001 From: maxwell Date: Fri, 9 Jul 2010 18:41:39 -0700 Subject: [PATCH] DG MS debugging friend request --- app/controllers/people_controller.rb | 3 +-- app/controllers/requests_controller.rb | 2 +- app/models/user.rb | 3 ++- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb index d8769d448..9c8d2f711 100644 --- a/app/controllers/people_controller.rb +++ b/app/controllers/people_controller.rb @@ -12,8 +12,7 @@ class PeopleController < ApplicationController end def destroy - @person = Person.where(:id => params[:id]).first - @person.destroy + current_user.unfriend(params[:id]) flash[:notice] = "Successfully destroyed person." redirect_to people_url end diff --git a/app/controllers/requests_controller.rb b/app/controllers/requests_controller.rb index 4bafd6d54..e6528d156 100644 --- a/app/controllers/requests_controller.rb +++ b/app/controllers/requests_controller.rb @@ -9,7 +9,7 @@ class RequestsController < ApplicationController def destroy if params[:accept] current_user.accept_friend_request params[:id] - flash[:notice] = "you are now friends with #{@request.person.real_name}" + flash[:notice] = "you are now friends" else current_user.ignore_friend_request params[:id] flash[:notice] = "ignored friend request" diff --git a/app/models/user.rb b/app/models/user.rb index 872d35a48..14ec61077 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -29,10 +29,11 @@ class User < Person def send_friend_request_to(friend_url) unless Person.where(:url => friend_url).first p = Request.instantiate(:to => friend_url, :from => self) + puts p.inspect if p.save p.push_to_url friend_url - p end + p end end