GymPal: A Workout Management System Built On Rails

Jamal Rjoul
2 min readMay 21, 2021

WHAT IS GYMPAL?

Anyone who knows me will know that gym is life for me. One of the list obvious reason as to why I love staying fit, its because exercising has been scientifically proven to be one of the most effective ways to keep our IQ level from deteriorating. In particular, heavy lifting, of all exercises appears to be the most effective in achieving this. What’s this to do with a rails application you may ask; well, if you are like me, you love to procrastinate and are stay swayed back into that deadly comfort zone. My personal reason for my procrastination is not seeing results after periods of hard work, due to a lack of effective training, based on an incremental strategy. GymPal has been designed with this challenge in mind. GymPal is a workout management system which all my fellow procrastinators can rely on when loosing track and drifting away from the path of righteousness.

BUILDING GYMPAL

MVC SOFTWARE STRUCTURE:

This application has been built with Ruby, Ruby on Rails and HTML (erb). The structure of this application follows the MVC software design pattern. This acronym stands for:

M: the Model/s are our database mappers. Here we store all the logic we need to interact with the database by way of creating, reading, updating and deleting the data stored in it. This section is directly connected to the routes.

V: the views section is where we design and store all the code we user for the user interface. Everything we want the user to see and interact with is built in here, mostly with HTML, CSS and JS in the form of ERB files.

C: the Controller/s is where all our routes and url’s are designed and stored. This is code which is designed to receive requests from the user and efficiently and precisely direct those requests to the right model. Once the model has retrieved the requested data, such data is then returned to the appropriate route who then redirects it to the requesting user.

KEY TECHNICAL FEATURES:

ROUTES:

The application routing system has been built with a combination of some the most common routes methods, i.e.;

  1. Standard REST: hard coded to route to an explicit and specific controller action. Syntax e.g. — “get ‘/register’, to: ‘users#new’”-
  2. Resources: a method which allows you to effectively select and call all the 7 standard actions (index, new, create, etc)within a specified controller. Syntax e.g. — “resources :routines”
  3. Nested routes: this method allows a resource controller access a selected group of actions from a completely different controller.

AUTHENTICATION: Omniauth

In order for the user to login to their existing account, I have built 2 paths for the user to achieve this. 1) via email and password, and 2) through the use of a authentication providers, which are Google and Facebook. At the back of this login path sits Omniauth. Omniauth is a Ruby gem which along with the provider gems (omniauth-facebook, omniauth-google-oauth) will work together to allow GymPal to verify and authenticate the user’s credentials, without the user having to follow the traditional log in process.

--

--