KatPadi's Point

Category: Code

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…

Time-Lapse Video Generator Using Raspberry Pi

So, I’ve been tinkering with my Raspberry Pi for the past couple of days. This weekend, I started with my time-lapse video generator using Raspberry Pi and its camera module. Taking snapshots is easy because RPi has a built-in raspistill command: raspistill -hf -vf -x -o melody.jpg There are many options which you can find here. When I connected the camera…

Service Object Adventures

I have read a lot of Rails articles and most of them always tell you to keep your Rails controllers skinny. It sounds so easy but it’s really not. As the cliche goes, “it is easier said than done.” In real life, requirements get complicated. Controllers and models get longer and longer and you need to do something about…

Yet Another Rails Adventure

I’ve been playing with storing and setting dynamic stuff in Rails because I’ve been repeating similar codes over and over and it’s becoming annoying. Luckily, I found a pattern and started to experiment from there. In a nutshell, this is what I’m trying to achieve: Create dynamic re-usable sessions from a param[:filter] if it exists. For…

STI

As I dive into more Rails-y stuff, I was told about the concept of Single Table Inheritance. (s/o to MJ for introducing me to this!) This Rails design pattern is characterized by using a single table that stores data from multiple models that inherit from a base model (the parent class of STI) which inherits from ActiveRecord::Base. (Whew!) OK,…

Meet Ernie

Note: This blog post is 2 weeks late. We (as usual, I was with Mark Steve) joined this event called Textify and we were given a month or so to think of an SMS-based project and build it. It was hosted by Chikka with the help of Smart DevNet to promote the use of the recently launched Chikka SMS API platform. At…