Alpha Camp: Week 4 of 12 Learning Journal

An authentication system…. and some memory tests!

Kenneth Teh
4 min readOct 23, 2017

I was quite disappointed that my first attempt to deploy my Rails App (the side project from last week) didn’t work as expected! I’d (very mistakenly) assumed it was a simple matter of uploading the files to the cPanel file manager and then somehow creating a database. My virtual server provider: ‘You thought we’d keep our Ruby updated and have a good library of gems? Hah!’ Still experimenting with Heroku, and I’ll keep you guys updated!

The rest of this going to be in the ORID format.

1. Objective:

What did you do this week?

We started the week with an introduction to using Github to collaborate — instead of the free cloud storage we were using it for before! Pretty cool stuff, but of course learning painful new ways of doing things along the way. (git rebase, I’m looking at you.) We would use this throughout the week because we were working in pairs.

Then it was time for Rails associations: Generating a second model, linking that back to the first model, and making that relationship useful…

We worked on the reading list project from last week, adding a bookmark function to it:

Yes, same picture as last week’s journal. Blogged late last week 👊
The child database (and view) for bookmarks

Our pair project for the week was making a To-Do list app. This was pretty standard, since it was exactly like the practice app (reading list with bookmarks), with slight modifications.

The exciting (and extremely challenging part) was building the login system. This was a stretch goal for us, but while waiting for my partner to complete the CSS styling, I decided to try to implement it while following a guide. (A few sources I had read convinced me that I needed to build the authentication system from scratch to learn how it worked. No gems for me! Of course, I later found out that the devise gem simplifies it and only takes 30 minutes to implement!)

The first challenge for me was to build a generic login system that would segregate non-authenticated users from authenticated users. This took me the better part of 2 hours, referring to the guide. Most of the difficulty was trying to wrap my head around how the different controllers interacted with each other, and how that would work with an existing app with two associated models and controllers (versus one built from scratch). It then took another hour to figure out how to only allow users access to their own account (and task lists).

Anyway, here are some screenshots:

The login page!
Post-login
Task lists (with search! Figured out a neater way to implement it this week)
Learnt how to sort by due date and completion status. #contented

On Saturday morning while waiting for the car to be groomed, I did some practice to rebuild the reading list app, this time without referring to my notes and without using most of Rails’ inbuilt generate functions (apparently this is the format for the mid-term exam). Took me maybe 50 minutes to make the first part (reading list), then another 50 minutes to get the second part (bookmarks) working. So many tiny details to take note of!

And of course Bootstrap comes to the rescue with the page and table styling!
This was tough to do from memory…

2. Reflective:

How did you feel this week?

The login system was painful to implement, but it felt great to finally get it working.

It was actually really satisfying getting the reading list app working without notes. I think that’s because I really have to activate all my problem-solving skills (and I suppose my OCD as well).

3. Interpretive:

What did you learn this week? (not a lecture note) Any reflection, questions, and problems

I think I covered most of this earlier! There was quite a bit of independent learning this week, since 2 1/2 days were dedicated to the project. The two major things I learnt were: 1) Authentication and 2) Building a Rails app without generate commands.

4. Decisional:

What are you going to do next week? (plan or goal for the next week)

Still trying to deploy my side project!

Also need to neaten up my notes and prepare a “cheatsheet” to better remember the different files needed in a Rails app.

--

--

Kenneth Teh
Kenneth Teh

Written by Kenneth Teh

Software Engineer primarily working with Rails and Vue.JS... sometimes DevOps and shell stuff too

No responses yet