On Rails

Makers Week 8: Ruby on Rails, Discover Weekly, and Moths

Naz M
codewhale
5 min readMay 9, 2017

--

Raminagrobis by René Magritte

Welcome to my blog about learning to code at Makers Academy. If you missed the last post, you can find it here.

Ruby on Rails

Ruby on Rails was something that baffled me in my first few weeks of coding. I was learning Ruby, but a huge proportion of jobs, articles, and questions online were referencing this mysterious Rails framework. Did my Ruby knowledge still apply to Rails? Is Rails a different language altogether?

The answer is it’s simply a way of getting a website up and running super fast, using the Ruby language. How to do it? The clue is in the name.

When you run Rails, hundreds of files load themselves into your project folder, organising your project in a very specific way, creating a bunch of stuff you never asked for. Want to make a model, run rails g model model_name, and boom, there it is. A controller, rails g controller controller_name. Everything to do with user sign in/sign out can be created with one command using the devise gem, something that took me days back in week 3.

This week we had to build a restaurant review web app, similar to Yelp.

We quickly learnt that in Rails, you have to follow the tracks. It feels kind of violating, especially after weeks of being taught to consider every line of code you write. Additionally, the course content for this week was a little prescriptive for my liking, and much of the time the work felt like following instructions, rather than thinking independently. Perhaps it’s a problem inherent in learning a new framework, but the whole experience was a bit lacking in mental stimulation.

That said, I’m glad I’ve encountered Rails at this point in the course. After building models, views, controllers, and databases from scratch, I feel I kind of understand why Rails is doing most of what it is doing, even if some of it might turn out to be superfluous to my project. If I’d tried to tackle Rails 6 weeks ago I’d have been hesitant to touch anything.

Using it for the weekend challenge (building Instagram) reinforced what a good tool Rails can be for cracking out MVP’s in a short space of time. In a couple of hours and with a handful of commands I had a website that allowed a user to submit an image, display it on the home screen with all the other images, and had sign-in/sign-out functionality.

Adding the ‘login with Facebook’ button took a little more time, as did connecting my databases in the correct way, but these felt more like teething problems that serious issues in understanding.

I’m looking forward to learning how to integrate AJAX into my Rails projects to create single-page web apps in the future.

Feb ’17 cohort graduation

The cohort above me graduated from Makers last Friday, and their final project presentations were mighty impressive.

One group build a BitTorrent client and another made a machine learning application that analyses the semantics of tweets. There was a functioning search engine and a multiplayer online block building game. All in two weeks!

It was pretty inspiring to realise the scope of what is possible in a short amount of time.

NazBot

Now he’ll use the contents of your tweet to reply with a story from the Guardian. This is what happened when I tweeted him ‘cheerios’.

I’ve challenged myself to try and make him do something different on a regular basis. It should be a great way to get familiar with lots of different APIs.

On the subject of bots, I’ve been stumbling upon some awesome ones lately. The below article has some of the best.

Discover Weekly

As it’s so damn good, I decided to do a bit of research into Spotify’s Discover Weekly playlists to find out how they do it.

For anyone who isn’t familiar, every week Spotify generate a tailored playlist of songs for each of their users. In the last couple of years they’ve got astonishingly good at it.

They do this by harnessing the insane amount of data they have on people’s musical tastes. It turns out the key ingredients in discover weekly is other people’s playlists and a personalised “taste profile” of genres for each user.

It gets even weirder when you listen to someone else’s Discover Weekly playlist, as I encountered that day in the cafe, or in the weeks since when I have cajoled other Spotify users into sharing their playlists with me.

It feels a bit like taking a momentary trip — both the geographic and psychedelic kind — into someone else’s head.

There’s a strange feeling of unease that comes with listening to a mix that is optimized for someone else’s subjective tastes and unconscious preferences.

For a more in-depth exploration of the ways they harness the power of deep-learning, have a gander at this.

Relaxation

Tabby Cat Chrome extension. New tabs mean new cats. Simple.

I was also introduced this week to the world of high-tech pranks. I learnt about one example when someone set a friend’s phone to quietly play the noise of a seagull every time it came within a certain range of their laptop. They then told everyone in the office to deny hearing it. Cruel, but well played.

TODAY’S JAM

If this doesn’t make you smile nothing will.

If you read past the tapir, chances are you read the whole thing. If you enjoyed it, please click the little heart below. It’ll help others find this and enjoy it too.

--

--