How do I build a freecodecamp clone using Ruby on Rails

How do I go about building a coding challenge site like freecodecamp. I know how to embed code editors using code mirror or ace.c9. But these editors don’t compile the code and I also don’t know how to add the “run the tests” button.

Where can I learn to implement a site like this (preferably using ruby on rails)? I there anything I need to learn or any tutorial I can use?

A good start is with freeCodeCamp itself, which is dead simple to build, and based on a modern application design: