0

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&current=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

1
Contributor
1
Reply
2
Views
6 Years
Discussion Span
Last Post by Trilby1992
0

Fixed. I simply forgot to put a colon in the Friendship model when I was setting up the request transaction. :)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.