In this short article, I would like to brief about “Rails polymorphic associations“. Below are the high-level pointers.
- What is Polymorphic Association
- How Rails handles it
- Example explained
So, Let’s start:
- What is Polymorphic Association: In OOP, Polymorphic means “of-many“.
There is a well documented and well explained Railscasts for this. Refer to this link for more information: http://railscasts.com/episodes/154-polymorphic-association
- Example Explained:
Code snippet can be downloaded from Github. The path for the same is: email@example.com:puneetpandey/rails3_singleTableInheritance.git
Once set-up. Type the URL’s below:
- Demo: Live Demo can be viewed from my Heroku App. Please click on the link: http://blooming-peak-9982.herokuapp.com/users