Latihan 1 dari materi Polymorphic Relations di Database — praktek dengan editor kode interaktif, test case otomatis, dan hint terpandu. Langsung jalan di browser.
Buat fungsi buildPolymorphicQuery(type, id) yang menghasilkan pseudo-SQL WHERE clause untuk query polymorphic:
type adalah string nama model (misalnya "Post", "Video")id adalah number ID dari modelReturn string format: "commentable_type = '<type>' AND commentable_id = <id>"