Brush up Your Knowledge of Rails Associations

relational database data table related symbol vector illustration concept flat

Rails 5 is coming very soon (it’s currently at RC1), so while preparing for this major version, it is high time to revisit the basics. Today we are going to discuss ActiveRecord associations.

Associations make it much easier to perform various operations on the records in your code. There are multiple types of associations available:

  • One-to-one
  • One-to-many
  • Many-to-many
  • Polymorphic one-to-many

In this article we are going to discuss all of them as well as some options for further customization. The source code is available on GitHub.

Continue reading %Brush up Your Knowledge of Rails Associations%

Source: Sitepoint