At the start of this week I was not a fan of Rails, However I can see the potential it has to make simple things exceptionally easy. One week of working with rails is far from enough to realise this potential and I felt it I was struggling to make any decent progress with it.
This week we were split into teams to work on a instagram clone, called snappy gram. Working in a team of four this time two pairs programming would have made sense. However there was so much we didn’t know we weren’t able to pair effectively. Instead we sat on the sofa round the big TV and coded as a four. This worked quite well to discuss problems we came across but is definitely not the most productive way to organise a group in terms of code generation.
Working more, it became increasingly clear how important it is to embrace Rails, to use convention over configuration. If you do not do this then you are missing the point and potential. A good example is link tags. We were easily able to see how to create links by mixing erb statements into the html. Instead the rails way is to us a link helper to make this just that bit easier. This has led me to formulate my golden rule of Rails.
- Google it first.
Rails is an enormous project with a very active community, because of this is has a great number of gems which cover almost anything you could think to do in a project. This means that when you have a problem it’s probably solved and the solution packaged into a gem. A great example from this week was the following. We wanted to make it possible for people to tag the uploaded images. We started down the route of database migrations before we came across the ’acts-as-taggable’ gem. This makes making an object taggable ludicrously trivial.
The size and scope of these Rails plugins varies enormously. King of these gems is devise. This gem solves everything to do with user sign-up, sign-in, password storage and more. The magic is more than a little disorientating it really is impossible to understand everything it is doing in the time-scale we have. However we got it too work and the only downside seamed to be the mad English it introduces. Words such as omniauthable have now entered my vocabulary.
At the end of this week I am much happier with Rails. I see why purist developers can object to it but I also see the point of it. Most helpful to my understanding of rails this week was this excellent series of lectures of efficient rails testing. I can not recommend these enough. Even though they are a little older the are still worth watching. Also as an explanation of authentication this rails cast is helpful.