How do I define a foreign key that points to a class of a different name in ActiveRecord with Rails?
- by Mark
Hi there,
I have a model Follow that defines a user_id and a followed_user_id. If you've used Twitter, this should make sense.
I'm trying to make followed_user_id point to a User model, so I can access the user that is being followed through f.followed_user (in the same way that if I have an Entry with belongs_to :user and a user_id column I can use entry.user to get the user.)
How can I do this?
Thanks!