“It would be so nice if something made sense for a change.”
I’ve just completed week 8 of Makers Academy. I was expecting to have a wonderful time with Rails, but it didn’t quite work out like that.
Let me start by saying that Rails is a magical and wonderful thing, and I fully intend to spend more time with it. It’s an open-source, full-stack MVC framework which pretty much does all the groundwork for you out of the box, leaving you to concentrate on the meat of your application.
Up until now, we’ve pretty much been doing everything from scratch — creating all our model and spec files, defining routes via the controller, implementing secure user management etc.
Rails does this all for you. It’s so quick and easy, I couldn’t believe how quickly we got up and running, and how easy it was to create the basic CRUD (create, read, update, delete) functions.
It was also really wonderful to go back to Ruby after two weeks of JavaScript, as Ruby really is so pleasant to work with (no offence JavaScript — you’re loved, just in a different way).
The horror, the horror.
The problem with a system doing everything for you magically, is that when you encounter an issue — it’s harder to diagnose and fix.
A couple of things in particular threw me:
- We managed to get Facebook authentication working on day two which was TRULY FANTASTIC, but only after 6–7 hours of head scratching, trying to figure out how and where to store our Facebook app id and secret (without accidentally publishing them to Github), getting Facebook to accept these credentials, and then de-bugging why the authentication wouldn’t work. Truly hair-pulling. But wonderful when you get it working.
- If you change your model associations, e.g. review belongs_to restaurant, Rails will automatically do some nice things for you (give you access to certain methods etc) BUT it won’t actually change the database for you to reflect the new relationship (unlike DataMapper, which we’d used previously). You have to manually write a ‘migration’ in the command line, and from that it magically guesses what you are after (this really is incredible) and generates a migration file. You check this file to make sure it’s doing what you hoped, THEN you run db:migrate to make the change.
- I had serious conceptual issues with trying to ‘insert the user_id into my reviews table’, when actually I should have been thinking higher level about associating the User object with the Review object, and I should have read more closely the Rails documentation on associations. Mind you, once I sorted out the association and it appeared to be working beautifully in the database and in the interface, loads of my tests failed because ‘current_user’ (which I was using to associate) is only available in the controller. Oh, I had fun this day.
Coaching at Makers.
A note on Makers’ style of ‘teaching’. I asked for help a number of times this week (very much the last resort — we have a whole escalation process to help us become independent problem-solvers), and our coach Ben refuses to answer questions directly! Instead he asks us back endless questions to make us think about what we’re trying to do and enable us to discover the answers ourselves. It’s frustrating because at this point you’ve already been trying for hours, but actually you do eventually arrive at the answer (after feeling incredibly dumb and exposed) and it makes a lot of sense from a pedagogical viewpoint. I remain very impressed with Makers Academy for their innovative approach to education, despite suffering from its intensity! I guess it isn’t called a bootcamp for nothing.
My main takeaways this week.
- Don’t be afraid to look dumb.
- Perseverance pays off.
- Slow progress is still progress.
- Look how far we’ve come in just 8 weeks!
Thanks again for reading!
Frances x