After trying to rake:db migrate, I got this error in the terminal
rake aborted!
ArgumentError: Unknown key: :conditions. Valid keys are: :class_name, :class,
You should change the code in User
model to
class User < ActiveRecord::Base
has_many :user_friendships
has_many :friends, -> { where(user_friendships: { state: "accepted"}) }, through: :user_friendships
has_many :pending_user_friendships, -> { where(state: "pending") }, class_name: 'UserFriendship', foreign_key: :user_id
has_many :pending_friends, through: :pending_user_friendships, source: :friend
end