Use messages.empty? instead of the deprecated has_messages? method.