First page Back Continue Last page Overview Graphics


However, what if you want to get all artists that appear on albums that this artist appears on.

That requires three join tables. You need to go through the albums_artists join table, use the artists table as a join table, and then go through the albums_artists join table again in the other direction.

The many_through_many plugin allows you to write a small amount of code to create associations that would be very difficult to create with ActiveRecord, and impossible to eagerly load.

With this plugin, you can eagerly load the related artists for a group of artists, and at the same time you can also eagerly load the albums for all related artists.