class Album < ActiveRecord::Base has_many :songs belongs_to :artist has_many :transactions end class Artist < ActiveRecord::Base has_many :albums has_many :transactions end class Song < ActiveRecord::Base belongs_to :album has_many :transactions end class User < ActiveRecord::Base has_many :transactions end class Transaction < ActiveRecord::Base belongs_to :user belongs_to :album belongs_to :song belongs_to :artist end