Rails New
By Selena Small & Michael Milewski
As seasoned Rails developers, we all know that the first step in building any standard Rails application, is to open the command line and run:
rails new [app_name]
One of the cool things about Rails camp though, is that it brings together people of all different experience levels and backgrounds. And who better to ask for help in spinning up a new Rails app than someone who’d never done it before?!
Jess works on the help desk at a university and a friend had recently got her into coding. She’d started just a week before Rails Camp, installing ruby. Excited to get started, and very quickly we got snagged in various discussions around all the things going on.
What’s a Git?
One such discussion was on Git. Rather than just explaining some concepts, we decided to show our pair what this git thing was all about. Very quickly Jess was creating directories, git initializing them, putting files in, modifying them, seeing the diff of her changes.
Finally understanding why we use git, Jess pushed her first ever commit! Since we were off line in the wilds of Tasmania she pushed her changes to the local server running Gogs (https://gogs.io/) a self hosted git service maintained by the organisers of RailsCamp.
Commit 289b842
Author: Jess Brown <noiselessdwindle@users.noreply.github.com>
Date: Sat Nov 24 11:52:19 2018 +1100
Initial Commit
Co-authored-by: Michael Milewski <saramic@users.noreply.github.com>
Co-authored-by: Selena Small <SelenaSmall@users.noreply.github.com>
Signed-off-by: Selena Small <SelenaSmall@users.noreply.github.com>
The real eye opener for Jess though, was when we pulled a copy of the commit on another machine!
“Git is awesome. Now that I finally know what git is, I should start using it to keep track of all my changes. It is awesome!”
What is a Server? and where is the Code?
It is a fascinating and fine line as teachers, you have to allow enough freedom for a student to feel comfortable to voice their misconceptions and to be able to take these and turn them into a learning moment.
Having just started up a rails server for our new app, and seen a welcome page in the browser our new comrade was full of excitement! That was until we said “Lets kill the server”
Jess thought that “the server” was “the code” she had just helped write. And in “killing the server” she was worried that we would kill all her code and move on to get someone to write it instead.
Don’t worry Jess your commit is still in the repo ;) and you are the largest contributor, by far topping out over one thousand lines!
Using the analogy that an instance of a server is like a physical library. We explained that you can go to the library, open the door and grab a book. In this case the only book is “yay you are on rails” (the default rails page) and the only instance was on port 3000.
We opened some browser windows pointing to different ports
hoping to show Jess that the code she helped create, was the blueprint for these new “libraries” or servers that could be instantiated on different ports.
Having never fired up the same rails app multiple times on the same computer (because why would you?), it became a little disconcerting to be greeted on
rails server --port 3001
with an error message:
A server is already running. Check pid. Exiting
Not wanting to dig too deep into PID files and processes with someone who is already learning so much, we hoped for a smooth exit strategy.
Throwing it back at Jess in the hopes of buying more time to magically think up a solution. We asked her what she would do
“There must be some sort of help manual?”
Thankfully Jess was there to help us help her! We got her to type
rails server --help
which quickly found the way forward using
--pid
to specify a pid file for each server
rails server --port 3001 --pid=tmp/pids/server_1.pid
rails server --port 3002 --pid=tmp/pids/server_2.pid
Have you ever had Impostor Syndrome?
During our pair session, we also discussed impostor syndrome with Jess asking if either of us had ever felt like an impostor.
Jess: Especially coming into the IT industry at mature age…
Selena: Yes. All the time. But after a while you realise that as a developer you never really know what you’re doing.
Michael: I felt the sweat gather and a bit of impostor syndrome as a teacher at the various questions around servers, bash etc coming into this pairing session, who was I to be able to help someone understand servers and rails, there was a lot of pressure to finish with a pleasant and successful outcome.
5 minutes with Jess
Q: How did you find the pairing, Jess?
A: I have trouble teaching myself and really enjoy learning in a class room so I can ask questions. I have a mild form of ADHD - but only the ADD Attention Deficit Disorder - which means I am slower to be able to process information. This was amazing, having two people pair with me and take me down the various paths I needed to explore in order to learn!
lolcommit
Oh and yes the camera was rolling to capture the emotion straight after almost 2 hours of pairing and that first rails commit.
Authored By:
Selena Small & Michael Milewski