words list

scope :word_learneds, ->(user_id, category_id) do
word_ids = UsersAnswer.select("word_id").where(user_id: user_id).to_sql
where("id IN (#{word_ids}) AND category_id = ?", category_id)
end