KatPadi's Point

Category: Codes

Autocomplete Using Redis

Usually, when we implement suggestions in autocomplete input fields, we query directly to our database. Relatively, LIKE queries in MySQL are slower. So why not autocomplete using Redis? Disclaimer: This is a basic Redis solution for “just-trying-it-out” purposes only. Motivation As I’ve mentioned, I got annoyed by the slow autocomplete results of an app that I…

Ruby Gem That Makes Your Model Activatable

Aktibibo is a simple Ruby gem that makes your model activatable. It allows an ActiveRecord model to be declared as “activatable” thus providing scopes for querying and filtering objects. Of course, the module adds convenience methods for setting an instance as active, inactive or deactivated. As an additional feature, it also saves the activation and deactivation dates because it uses datetime DB…

Policy Object Adventures

A few months back, I wrote something about my service object adventures to handle extraction of a business logic from a Rails model or controller. Recently, I got introduced and experimented on the concept of policy object. Policy objects are pretty much just like service objects. In fact, from what I understand, policy object is actually…