Fix for Flaggable as an STI model 

Check flaggable using a where clause, so picks it picks the right table type of the flaggable in cases where flaggable uses STI.