My most important take-aways from this week full of Rails magic:
- Do not touch the link tags in application.html.erb.
- Do not compile your code locally.
- Do not mess with the sprockets. Ever.
Phew! OK. I will follow these warnings.
Furthermore I can report that Michael’s much used term of something being “borked” (usually a database) has now entered my active vocabulary and used it this morning in the context of our boiler. (Luckily we managed to un-bork it and I didn’t have to go to the gym to shower after all.)
So far, I have to say that Rails is being kind to me. Things are working and if they’re not, I understand how to fix them. But maybe this also has to do with the instructors being kind to us – I feel like we’re not moving at lightning speed anymore like in the first couple of weeks. We seem to be taking a bit more time to repeat important things. The homework projects on Wednesday and Thursday were fine too. In contrast to previous weeks where I sometimes felt like I was trying to build a spaceship, I now feel more like I am applying something that we learnt during the day. Which is probably the actual purpose of the homework. I’m not sure if this is the instructors’ intention or just my personal perception. Maybe I’m just more used to learning now? Maybe I know how and when to ask for help better than in the beginning? Comments are welcome.
Continuing with our Rails basics lessons, we learnt some tips and tricks for debugging our apps, how to create partials and what the deal with the Rails models and the asset pipeline is.
On Thursday we were introduced to associations in Rails which initially went so far over my head that I thought I would need to get one of these butterfly catching nets to collect it again. But we are practising the different associations one by one now and it is kind of making sense.
We started with the ‘one-to-many’ association (using our very basic cookbook app as an example: a recipe can only be in one category but a category can have many recipes).
On Friday afternoon Jarkyn and Alex (our teaching assistants) demonstrated a ‘many-to-many’ association using the example of a student and beer app: one student can drink several different types of beers and each type of beer can be drunk but several different students. Many-to-many. It was a bit hard to follow when all that everybody could think about was finally going to the pub and people had been putting images of beers into our HipChat group since about 11am in the morning. But I tried to cut through the thirst and really pay attention as we needed this for our weekend homework (another recipe app!).
I have to say, so far it paid off and I managed to create the ingredients object (a recipe can have many ingredients and one ingredient can be used in many recipes) and run the database migrations. So far, so good!
I hope I haven’t jinxed my luck now and will need to turn into a crying wreck over my laptop when I try to actually display the ingredients on a page and create the functionality to add new ingredients to recipes.
Ah, one more thing: on Friday we also learnt how to push our apps to Heroku, a free cloud hosting service. So finally I can put stuff that I create on the internet! Very exciting.
Fingers crossed for my homework – hopefully the internet will get to see those ingredients in my app of German recipes…