Category: Ruby On Rails

  • Should you add Gemfile.lock to Git?

    TLDR: Yes for apps. Yes for Gems. Do you use version control to keep track of changes to your codebase? Or do you think version control is for the cowardly and just change files in a shared team folder and hope no one else is changing it at the same time? Of course not. You…

  • Rails Benchmarking

    So, you want to know fast your Rails app is going? If you just want to see how fast a bit of code is you can use the Benchmark module which is part of the Ruby Standard Library. If you want to compare two or more bits of Ruby code that do the same thing…

  • Service Object (Ruby on Rails)

    Service objects are Plain Old Ruby Objects used to extract code from a part of the application where it doesn’t really belong and isolate it in its own, testable file. They often look like: They can then be called like this: This simplifies your controller and makes it much more understandable. It also separates the…