Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: f258af4980
Fetching contributors…

Cannot retrieve contributors at this time

28 lines (21 sloc) 0.643 kB
class UsersController < ApplicationController
before_filter :authenticate_user!
def index
@user = current_user
end
def show
@other_user = User.find(params[:id])
@is_friend = current_user.friends.where(:friend_id => @other_user.id).exists? || current_user.id == @other_user.id
end
def add_friend
other_user = User.find(params[:id])
friend = Friend.new(:friend_id => other_user.id)
current_user.friends.push(friend)
redirect_to user_page_url
end
def del_friend
friend = Friend.find(params[:id])
current_user.friends.delete(friend)
redirect_to user_page_url
end
end
Jump to Line
Something went wrong with that request. Please try again.