Looking for an excellent replacement for if conditions where you check if an object and its attribute are present? Meet null object and give it a try
Usually, you don’t think about tables naming because it’s obvious. However, there is a case when you might stop for a second. I’m talking about a self-join instruction.
Since belongs_to relation is one of the most common association in each Rails application I bet that you deal with it many times in your application. Let’s say that we have two models: Job and Category – one job belongs to one category and category can have many jobs, simple as that.
Learn how to encapsulate your queries in a Rails model to stay DRY