これは私のコードです:
class Friend < ActiveRecord::Base
belongs_to :user
belongs_to :friend, :class_name => "User", :foreign_key => "friend_id"
end
class User < ActiveRecord::Base
#...
has_many :friends
has_many :users, :through => :friends
#...
end
ユーザーの追加を開始すると...
user.users << user2
user.save
フレンドの user_id のみが入力され、friend_id は null です。
何か助けはありますか?
あなたの、ジョーン。