This line is the problem
follows.where(followable_id: followable.id, followable_type: followable.type ).any?
Replace followable.type
with followable.class.name
type
used to be a synonym for class
but this was deprecated. Even if it hadn't been deprecated, you need to find records where followable_type is the name of the class, not the class itself.