RailsCasts Pro episodes are now free!

Learn more or hide this

Polymorphic Association (revised)

#154 Polymorphic Association (revised)

May 19, 2012 | 11 minutes | Active Record, Routing
A polymorphic association allows a model to belong_to different types of other models. Here I show how to make a single comment model belong to articles, photos, and events.
  • Download:
  • source codeProject Files in Zip (321 KB)
  • mp4Full Size H.264 Video (19.5 MB)
  • m4vSmaller H.264 Video (11.6 MB)
  • webmFull Size VP8 Video (14.8 MB)
  • ogvFull Size Theora Video (24.4 MB)