For any person learning to code, your first experience with Rails makes you wonder whether there really is some real magic involved in coding. Rails is an open source web application framework which is written in Ruby and used to develop Ruby applications. It helps you to create pages, render layouts, and connect to databases all through relatively straightforward commands in the terminal.
To introduce us to Rails, Alex drew out a diagram which helped us to think about how to approach building our applications step-by-step. On a very simplistic level: after an initial setup, you write a test for your first feature – perhaps something along the lines of checking that an instance of the feature can be created and viewed on the homepage. Then we make any necessary changes in our database before developing our new feature more fully, with tests leading the way.
In order to become competent with this new framework, our task for the week was to build a simple blogging application. Alex gave us a quick demonstration to start us off as well as point us in the direction of an easy-to-follow Rails tutorial. Throughout the week, we learnt about new technologies and methods to help us develop our blogging application, from incorporating jQuery, to add interactivity to our pages, to installing Devise, a gem which makes user management and authentication easy. It wasn’t my first time using Rails, but it had been a few months since I’d touched it, so it almost felt like new in some respects. What I found trickiest was figuring out a correct workflow, backed up by tests, when adding new components and features to my app. Sometimes I found myself just doing things at random points because I recalled seeing Alex do it at some point. However, part of working out when to take certain actions will come with experience. For now it’s key that I keep practising.
There were a range of things that went on during the week that made this one rather different and interesting, some to do with coding, some not. Some highlights include:
- Forming a final project team with good friends at the Academy and coming up with an idea centred around connecting the public to those who are homeless. We’re not sure if it’s going to work, but it was exciting getting somewhere with the brainstorming process
- Going to see the England v. Germany match at Wembley. Although we didn’t win, the atmosphere was exciting, and it’s always good to take a short break from coding…
- Having my second blog post published on The Independent website
- Spending an afternoon pairing on a Rails application with a director of a top digital agency. Reminded me why doing your research and asking the right questions can open the door to opportunities
- Going to see ‘Mojo’ at the Harold Pinter theatre with a good friend on Friday evening. Like I said, it’s always good to take a short break from coding…
I also really enjoyed the test this week. Rather than having to build an application, Alex provided us with 41 failing tests that we had to make pass. Examples of the challenges included working out the next year in which your birthday falls on a Friday and printing out the lyrics to the song ’99 Bottles of Beer’. It was like playing a fun little game, and best of all, it reminded us how much we’ve learnt and retained over the last eight weeks. Check out my code here, feedback is always welcome!