3 column :hbtm?

A Song :has and belongs to many Playlists.
I want to store additional information about a song in a given
playlist, i.e. the number of request of this song in a playlist.

Here is an example

Playlist a:

Song A|5 requests|
Song B|3 requests|

Playlist b:

Song A|2 requests|
Song B|4 requests|

In SQL I would add an extra column :number_of_requests to the
songs_playlists table.
But how do I do it with pure ActiveRecord?

You can make the join table be a fully fledged ActiveRecord model (it
will need an id column) and add the new columns to it. Then use
has_many :through rather then habtm

Colin

How would I do this? I am new to Rails.
:has_one request_count :through => "what do i put here? where do I
store it?"

Thank you

Have a look at the rails guides at http://guides.rubyonrails.org/
particularly the one on ActiveRecord Associations (assuming you have
already looked at the Getting Started one). Google will provide lots
of help too.

Colin

Thank you, everyone, I made it work through :through :slight_smile: