unknown column 'friendships.id' ??

I can't understand where it fails. I can add a friend to my friendship table, but I want to view my friends which I have after that. Rendering the view of this (index) fails.

I understand that I somewhere refer to my friendship wrongly, but it seems to find everything else. I can only find a referance in this log in the last row, but that tells me (like the noob I am) nothing. Someone got a suggestion (preferably a solution)?

Dag Stensson wrote:

  def index    #retrieves all friendships and friends for the specified user_id    @user = User.find(params[:user_id], :include => [:friendships => :friend])

It appears that your :include is messed up.

Eager loading has it's uses but it seems that lately it's being used for everything that it shouldn't be..

assuming you have the following relationship: class User < ActiveRecord::Base   has_many :friendships   has_many :friends, :through => "friendships" end

class Friendship < ActiveRecord::Base   has_many :users   has_many :friends, :class_name ="User" end

just do: @user = User.find params[:user_id]

and when you need the friends, just do @user.friends

hth

ilan