You might now what is a join between 2 tables. An post has several comments. In Rails, with use has_many in our models for that.
has_many
However, there are cases where we need a join IN THE SAME TABLE. Surprising right?
The Enumerable module of Ruby is very powerful. It defines a lot of method used by container objects (arrays, sets, hashes) like:- map- each- count
map
each
count
Here is a typical scenario when you develop your Rails application: you test your application manually by creating some data from the UI, and… you realize the data you created could be used to seed the development database.