Tutorials. All Rails

Trashing banner

Creating a trashing concern in rails 5

In some instances, we want to 'softly' destroy records; persisting in the database but making it inaccessible through ActiveRecord queries where defined. Trashing is what many would call and while there is the option of using gems such as acts_as_trashable, it is always a good idea to minimize the number of external dependencies. One approach to this would be to add trashed_at attribute to the ActiveRecord::Base class then querying for records whose ...

Read More
Gems banner

Create Ruby Gem by Example

There's no doubt the critical role ruby gems play in rails app development. Think of devise, active admin and the rest. Yet with all these, few developers get to create their own gems. Perhaps because of lack clear docs on practical approach. But at some point, an RoR developer maybe tasked with modifying a gem or creating one; at least once. Today, I walk you through creating a Ruby gem by example. We'll be creating an API wrapper around The TVDB. You c...

Read More
Caching banner

Speed Your Rails App with Model Caching using Redis.

While learning Rails, little emphasis is given on performance partly because most of those tutorials are usually small applications with minimal records. But as one progresses and starts handling huge apps, performance becomes critical. Optimizing queries and handling bottlenecks such as N + 1 query problem tops todo list. This is a challenge I have had to face and one of the best ways of improving performance is caching, in this case Model Caching. You can grab the code, having some other functionalities as well here
Read More


Multilingual Application with domain switch in Rails

For my first tutorial, I have decided to share what I have done in a couple of projects that were Multilingual(in more than one language). That can easily be achieved using internationalization gem which handles the translations but then the tricky part comes in when you want two different domains for each lingual site. You can grab the code here Github Repo

Getting started

Lets get started by creating a new ...

Read More