I am wondering about how StackOverflow’s tagging system works.
Stackoverflow has Question model and Tag model.
Question belongs to multiple tags like Javascript, Ruby etc.
Tag has many questions like questions on Javascript and questions on Ruby.
How would you set up the database tables to reflect this relationship?
My current solution.
Question has an attribute called tags. tags contains a list of integers referring to different Tag models. This way is really bad when you are trying to query all the questions for a tag model, since you have to go through a list for every question model.
Use a normal, classical, standard many-to-many association:
http://guides.rubyonrails.org/association_basics.html#the-has_and_belongs_to_many-association