Hi I'm trying to make a friend request feature like in a social networking site and I've
been getting this Unknown Attribute error whenever I try to request a friendship with an another user.
http://s1042.photobucket.com/albums/b429/Kevin_Tang/?action=view¤t=unknown_atrribute.png
And this is the code of the friendship controller.
class FriendshipController < ApplicationController
def req
@user = User.logged_in(session)
@friend = User.find_by_screen_name(params[:id])
unless @friend.nil?
if Friendship.request(@user, @friend)
flash[:notice] = "Friendship with #{@friend.full_name} requested"
else
flash[:notice] = "Friendship with #{@friend.full_name} cannot be requested"
end
end
redirect_to :controller => :user, :action => :index
end
def accept
@user = User.logged_in(session)
@friend = User.find_by_screen_name(params[:id])
unless @friend.nil?
if Friendship.accept(@user, @friend)
flash[:notice] = "Friendship with #{@friend.full_name} accepted"
else
flash[:notice] = "Friendship with #{@friend.full_name} cannot be accepted"
end
end
redirect_to :controller => :user, :action => :index
end
def reject
@user = User.logged_in(session)
@friend = User.find_by_screen_name(params[:id])
unless @friend.nil?
if Friendship.reject(@user, @friend)
flash[:notice] = "Friendship with #{@friend.full_name} rejected"
else
flash[:notice] = "Friendship with #{@friend.full_name} cannot be rejected"
end
end
redirect_to :controller => :user, :action => :index
end
end
I am drawing a complete blank on how to approach with this error even when looking for some similar errors on google.
Thanks