views:

9

answers:

0

I'm trying to create a database with two models a user and a an mp3 file. I want the user to have two relations on the mp3.

The following are the use cases I want to tackle.

User has created many mp3's many mp3's have been created by a user

User own many mp3's (He could have bought and mp3 from a store) many mp3's have been bought by a user

In my mind I'm thinking of having other tables such as "Library" and "WorkBox" that mediate the relationships but I'm not sure if there is a better way to get what I want to achieve?

In short I currently have

class User < ActiveRecord::Base 
  has_one :library
  has_one :work_box
end

and so on...

I guess I'll stick to this design but for some reason I think there is a better way. Can anyone see a better design alternative?