Rails has_one with class name and foreign key
问题 I have a Rails model which I use two has_one relations: requester and friend . When in the console I use: f = FriendRequest.all f[0].requester I get ActiveRecord::StatementInvalid: SQLite3::SQLException: no such column: users.requester_id: SELECT "users".* FROM "users" WHERE "users"."requester_id" = 4 LIMIT 1 . I don't really know how to specify a `has_one' relationship with a class name and a key which specifies the record. This is my model: class FriendRequest < ActiveRecord::Base has_one