This is not a how-to post, rather a post on why I built this app and some of the challenges I came across in the process.
The inspiration for my app came from Hope Schools in East London, South Africa. Hope Schools is a Christian school for children who are affected, infected and/or orphaned by HIV/AIDS. I traveled twice in 2017 on a
I thought it would be great to have a grading system that teachers could track their students’ information by classroom and semester. The result is Hope Schools: Rails app
Some challenges I encountered
Since I started Flatiron School, the labs in the online program were built with Test Driven Development or TDD for short. It was challenging to understand at first, working my way through errors, etc.
I saw this app as an opportunity to add tests and really learn how to keep my app clean and free from potential bugs.
Thouhgtbot has plenty of posts on integrating RSpec and Capybara into your Rails application. They also created an e-book with the corresponding repository. With this information, I integrated tests for the models to set up validations, associations
I also added the Faker and FactoryBot gems to call in the tests. Set up was ok because I used a few different resources to help with the process. I did have a bit of a challenge setting up specific tests for the models such as class scope methods. I plan to review the documentation further to set up these kinds of tests.
Seeding my data
Next up I worked on seeding my data. In my Sinatra project, I manually entered the information because I had two models and a smaller database. This time around I set up Faker to add more data to work with as I built the application. I initially had some challenges connecting the different models, partially due to validations, etc. I got the database to seed the data nicely, but the associations were off. I would definitely recommend being verbose with the seed data if you have a
Setting up PostgreSQL
Setting up PostgreSQL wasn’t too challenging. I used a mix of two articles, one from Medium and one from Coderwall. Once you follow the instructions to set up PostgreSQL on your computer and add the gem to your computer using Homebrew (if you are using a Mac), these articles will help with connecting PostgreSQL to either Postico or pgAdmin to interact with your database on the backend.
When you start your new Rails application, you can use the following command on the command line:
rails new myapp --database=postgresql
One thing to note, when you start your Rails server, start the PostgreSQL database or your Rails app will not load in the browser.
Overall, this was a challenging application to build. I had a lot of help along the way from the section leads to other students in the program as well as