Building a multi table relationship in Rails ActiveRecord
问题 I have the following models in Rails: Player Match Series And a Post model: Post I want to link each post to one of the above model. Need to create a new table that will have Object_type - player or match or series Object_id - Id of above object Post_id Is there a built in way to create such relationship in rails? and easily access a player's post like player.posts? (that will filter for object_type = 'player' in this relationship table) 回答1: Use Polymorphic Associations to manage