Having trouble with has_many through polymorphic for message flags