We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,167 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Unknown Attribute Error

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
1 Day
Discussion Span
2 Years Ago
Last Updated
2
Views
Question
Answered
Cricklewood
Newbie Poster
5 posts since Jun 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

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

Cricklewood
Newbie Poster
5 posts since Jun 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
Question Self-Answered as of 2 Years Ago

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.5150 seconds using 2.65MB