Creating A Learning Platform With Ruby On Rails — Part I

Hi, my name is Gilbert Torchon and I am learning Full-Stack Web Development at Flatiron School online boot camp.

As a final project for the Ruby on Rails section, I chose to do a Learning Platform a little bit similar to the one I used to learn about Web Application development. Basically, a user will be able to sign up then follow courses that was posted on the site by an admin for free. On the admin side he will be able to post courses, chapters and lessons. The lessons will be organized in two kinds: simple lessons and labs. Simple lessons are just lessons the user would read and mark as complete. Labs are basically exercises that a user can solve. These labs solutions will be then reviewed by the admin on the back-end side to validate them (only at this moment the user will see the lab as complete on his side). Enough talking, let’s dive into the details about how to make that work. (Then end result will be posted on this GitHub repository)

Project Architecture

Assuming that you (the reader) already have a knowledge of Ruby and already installed Rails on your computer, the only thing left to do is to generate the project using the mighty rails new name-of-your-project which will generate a bunch of files and folders. Your directory structure should look like this:

Directory structure generated by the “rails new” command

That being done, we can move to the next part.

Designing the Database

When doing any web development project, I find useful (after defining the idea) to design the database schema that the platform will use. The database structure is the backbone of your application and should be created with great care. Note that we will be using SQLite as our database engine thus our database will be Relational. SQLite has this specialty that it can be embedded to our program.

According to our project description our application will manage about 4 resources: users, courses, chapters and lessons. We can use them as table names in our database but that’s not enough. We also need to define how we want these tables to be related to each other. After thinking of it, generating all the migratiions, here’s how my schema file look:

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store