I am noticing a relation problem that I may have created.
I started off with a Photo model. An admin could upload photos and they would exist on the site.
In a later iteration Albums were added into the codebase so that a collection of photos could be organized on its own page.
Album
has_many :photos, inverse_of: :album
Photo
belongs_to :album, inverse_of: :photo
After playing with the above I noticed that a Photo can ever only belong to one Album. That has been ok.
Now a new issue arises. I'd like to add photos of members of the staff which are also their own model.
I also have some special logic in my Photo model to handle using a specific upload service (filepicker).
Staff
field :name, type: String
How can I make it so Staff can have their own photos? Should I create a new model StaffPhoto for denormalization? I was thinking of having Photo either embedded or belong_to Staff but then I'm not sure if it makes sense to belong to both an Album and a Staff member. The only thing making the most sense to me right now is creating a separate model and abstracting the upload service logic into a module and including it into both. However I could be wrong. The important part is that Photo's overall will exist on their own, or a part of an album, or a part Staff member (more than one photo).
Any suggestions on how to model this?