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…
Tag: rails
Code
Service Object Adventures
by Kat Padilla • • 0 Comments
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…
Code
Yet Another Rails Adventure
by Kat Padilla • • 0 Comments
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…
Code
ActiveRecord::Store for Settings
by Kat Padilla • • 0 Comments
Using the config.yml it’s fairly easy to store app settings that we want to be able to change quickly between environments. That is cool until your boss tells you that they need to be able to change it on the app itself a.k.a. on the fly. The initial advice that I got for this kind…
Code
Handling Global Exceptions for APIs
by Kat Padilla • • 1 Comment
I was able to teach myself (this includes a lot of Google-ing and asking) how to do some basic exceptions handling in a Rails app that uses GrapeAPI. I’ve experimented with Sinatra before for a hackathon so I was a little familiar with some of the concepts already but there are still things to learn (a lot actually!).…
Code, Thoughts
The Struggle Is Rails
by Kat Padilla • • 0 Comments
Late last year, I’ve decided to put “Learn A New Language” in my goals for 2014. I thought I had all the confidence to do it– to take another step towards improving my programming skills tremendously, and learn another language. My officemates know Rails (Ruby) and I can easily ask them whenever they’re free. One…