Lesson 21/32 · 2:40 min
Shouldn't the pivot table have model_id and model_type instead of just photo_id ?
model_id
model_type
photo_id
It's not photo_id, it's photoable_id
shouldn't there be a unique constraint or index for all three fields (photo_id, photoable_it and photoable_type) to avoid multiple assignements of one photo to a user?
Good idea, that would be a good extra constraint.
Shouldn't the pivot table have
model_id
andmodel_type
instead of justphoto_id
?It's not photo_id, it's photoable_id
shouldn't there be a unique constraint or index for all three fields (photo_id, photoable_it and photoable_type) to avoid multiple assignements of one photo to a user?
Good idea, that would be a good extra constraint.