rails polymorphic model implementation
问题 In my project, I have a relationship model that allow users to follow each other. class Relationship < ActiveRecord::Base attr_accessible :followed_id belongs_to :follower, :class_name => "User" belongs_to :followed, :class_name => "User" end Now, I want to also allow users to follow courses and groups. Do I start a new followedCourse and followedGroup model or do I make the relationship model polymorphic? How do I do that? Thanks. 回答1: I wouldn't use polymorphic for potentially-large tables.