Rails and default_scope

It should be common knowledge by now NOT to use default_scope unless you know what you’re doing. I thought I knew what I was doing but was wrong, which is often the case.

Imagine having a model with a boolean :finished attribute. And in your schema for this table default: false. You want to only ever retrieve instances that are marked finished, so you write

default_scope {where(finished: true)}

Great, but guess what? New instances of this model will have their :finished default to true, contrary to the schema definition. Crazy right? Don’t use default_scope.

Public commitments

Another one of those corny lifehacks I’m fond of is public commitments. I guess it’s semi-common knowledge that announcing your intentions publicly or better yet, to friends, prompts action. I’ve also noticed it’s useful for folks suffering from depression and anxiety, insofar that making commitments to see friends or attend events gets you out of the house.

With that in mind, I’m announcing my intention to pivot my career towards automation and ops, plug some holes in my game and learn a few new tricks. Luckily, like Arnold, my cpu is a neural net processor…a learning computah.


Despite using the terminal and interacting with servers almost daily, my knowledge is broad but shallow. I’m getting a lot of mileage out of Unix for Mages and Servers for hackers as refreshers for things I don’t normally do.


The tool of choice for automation scripting.

Ansible+Vagrant or Docker

Not sure which side to take yet, but for the time-being Ansible suits my needs nicely. Shout-out to the mad genius Shey over at polymorphic.ca for putting me on this path and sharing some of his hard-won knowledge and high quality scripts.


To remove a specific commit, aka reverse cherry-pick:

git rebase -p --onto SHA^ SHA

I've solved procrastination

That’s right, after 3.5 years of inactivity this blog lives again.

Such a long delay…but overcoming procrastination is Hard. To that end, some tricks that have helped me:

Do the smallest possible task

Start small and change 1 line of code. Wash 1 dish. Think about 1 thing. Almost always this snowballs into other tasks.


Obviously, right? But getting there is only half the trouble. Getting into flow is tricky and distractions are the mindkiller. F5'ing hackernews won’t get anything finished.

Visualize completing the task

Aaah the sweetest feeling. Completing something, no matter how small, is a morale boost. Small increments lead to big changes.

Several habits of a highly successful Roumen

Self improvement and productivity are aspects of my life I put a lot of thought into, but unfortunately not much effort. Habits are the investments and tools that should allow me to reach a multitude of personal goals and become a stronger, smarter, more patient and compassionate human being.

Creating a habit is a recipe in three parts: Knowledge, Skill, Desire. 1) I know that I need to really listen to people. 2) I must learn how to properly listen to people. 3) I must really want to listen. That’s the framework. 

Going forward, here are the habits I’m committing to. Some are daily, some are monthly. Some are ongoing. 


  • Floss.

  • 60 push-ups.

  • 8am start.

  • Daily schedule. Bullet-journal is crutch. Additionally, set monthly/ weekly/daily goals. Take more notes and jot down thoughts and ideas.

  • Memory exercises. Still need to do some research on this one and I keep forgetting (hah!)

  • Meditation & mindfulness.


  • Gym x 3 (Gonna try this in the morning for a change)

  • Write 750 words.


  • Read 1 non-fiction book.

  • Read 1 technical book.

All The Time

  • Listen. Really listen and pay attention to the exclusion of all else. The most important conversation is the one you’re currently having. Understand what the other person is communicating and what they want. Understand their motivation, and why they’re telling you this. Remember what they say. 

  • Be Patient. Impatience comes in constant waves. Be like a rock beneath; infinitely calm, infinitely patient. 

  • Be less selfish. Consider others; consider what they’re thinking, how they’re feeling, what they’re going through or have been through. Consider what they want and how you’re helping or hurting. Realize that your actions and inactions matter, though it may not seem so at the time. 

  • Think before speaking. Do not respond automatically. Consider the implications.

  • Meta-think. Think about your thoughts. Reflect on how you’re feeling and why. 

A good question to ask yourself during any activity is: will this help me in the future in any way? Will I gain some benefit down the line? ‘Yes’ indicates a healthy habit.

<< 5 of 7 >>
© 2021 Roumen Pavlov. All rights reserved.