It was indeed based on religious practices and religious acts. One must appreciate that religion in those days was just a way of life hence, no conflict with education. One had to follow a strict way of life which one has to still follow. educationtipsforall an ancient book talks in detail the education part; the system and methods to be followed.
It however, had some defects. Education was restricted to those who deserve and was not available to all. Second it was Guru (teacher) centric i.e. for every thing one had to depend on the guru and his knowledge was considered perfect. Buddhism democratized the education by allowing all to study. This helped to spread education and institutionalise education by forming Universities. Buddhism did not deviate from Hindu system of imparting education but made it broad-based. Here again educators and students had to be religious people and had to follow a strict rules. Even here it was not fully devoid of old Guru System.
Even Buddha said “Buddham saranam gachchami” (Come to Buddha to get enlightenment). Mind you, in ancient times the great saints did research on their own and developed body of knowledge which was in contrast to what Buddha said. However, he challenged the system of concentration of knowledge in few hand. This might have diluted the quality of knowledge but this improved the understanding of the people in general in India.
This also developed a bond among people of India which is keeping this country together. This is the secret of unity in diversity of India. A diverse country became one population having same principle of life that is achieving mokshya (eternal bliss).
Indians always paid great importance to education which would improve the ethical standard of the population. Resilience of ancient Indian education system was proved again and again. Since the early stages of foreign invasion India lost all its material wealth but not the Indian ethos and superiority of our (Arian) culture and believes. This was possible because of the foundation of Indian education system. Others talk about Ethics but Indians practice through education.