2009/7/25 Glex <[email protected]>: > > 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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

