Extend Rails code metrics

Rails ships with an easy way to get some quick code metrics about your application’s code and test coverage. For instance, running bin/rails stats will provide you with some important bits of information about the status and health of your project: +———————-+——–+——–+———+———+—–+——-+ | Name | Lines | LOC | Classes | Methods | M/C | … Continue reading Extend Rails code metrics

How to install ruby pg gem without PostgreSQL locally

Let’s say you’re using Docker for your local development in order to keep your development system nice and clean. Not having to install all needed dependencies on your local machine (like for instance PostgreSQL) and have everything packaged and documented for all developers is one of the advantages containers bring us. But when developing in Rails, … Continue reading How to install ruby pg gem without PostgreSQL locally

Useful Ruby gems to improve your code quality and skills

How do you prevent your application to deteriorate over time? Or even improve your coding skills? That’s a question a lot of developers ask. I like to include some handy tools that help me check the state of an application and code. Since everything is changing so rapidly, it is sometimes hard to keep up with … Continue reading Useful Ruby gems to improve your code quality and skills

Rails: display message when collection is empty

When working on a CRUD based application, starting with the index view, you’ll want to display a collection. But when the collection is empty, you’ll want to let the user know the collection is empty, by showing a message. Most common scenario I have seen so far is the following construction: <% if @collection.length > … Continue reading Rails: display message when collection is empty