Using model relationships to find number of responses by a user, to posts of a certain topic type
Try something like this, it would work if the #tagged_with method returns an ActiveRecord::Relation object, I don't know if you need a :user_id in there, but your code didn't hint on any, so I did the same.

Response.joins(:micropost).merge(
  Micropost.tagged_with(interest, on: :tags)
).count