I am looking for a code example that sets up something like this forum.
You are well aware of how it works; last updated posts show up at the
top and so on.
and it is a commonly used algorithm so I don't want to invent the wheel.
I rather read the code somebody wrote for my study.
what kind of study would that be? As you can see the answers might not be what you might have expected. Lack of explanation on your part is to blame, IMO. You asked for someone you to provide a site basically because you asked it with 3 sentences… you can realize why that wasn’t appreciated.
You can look up rails gems related to “forum”, maybe that will yield something. Otherwise, you got to be far more specific.