我正在創建一個用於在用戶之間上傳和共享文件的應用程序。 我有用戶和文件模型,並創建了第三個File_Sharing_Relationships模型,其中包含sharer_id,file_id和shared_with_id列。我希望能夠創建以下方法:Rails 3:我應該使用什麼關聯來創建模型關係
@upload.file_sharing_relationships - lists users that the file is shared with
@user.files_shared_with - lists files that are shared with the user.
@user.files_shared - lists files that the user is sharing with others
@user.share_file_with - creates a sharing relationship
是否有任何防護欄協會,如「多態」,我可以使用,使這些關係?
任何建議表示讚賞。謝謝。