Memories of the past prepare us for the future. If every day we had to re-learn how to tie our shoes, brush our teeth, walk, and a million other things we’ve learned over the years then it would be hard for us to make any progress beyond that. Using AI coding tools can feel a bit like this today, where every new feature or bug fix requires the tool to re-learn how the codebase is structured, how a…
If you write commit messages every day, you might find it helpful to have a template to help you format your messages. I’ve found a template helpful for including the names of co-authors I work with often so that I don’t have to look them up every time and for making sure my commits follow the format expected by the rest of my team. Setting one up is very easy! In this quick tip I’ll show you how…
When I started using MiniTest one of the things I struggled with was how to mock and stub objects when constructing my tests. Here are a few patterns I’ve collected over time and now find helpful when stubbing and mocking in MiniTest. Basic MiniTest Stub MiniTest comes with a way to stub a value for a test. Here is a classic example stubbing time: Time . stub :now , Time . new ( 2012 , 11 , 14 ).…
Today I Learned: git rebase –autostash Rebasing is something I do often in Git. The most common time is when I’m updating my branch with the latest “main” branch; I’ll typically use a rebase strategy on pull to avoid creating extra merge commits and to help keep a clean history. Often I’ll have uncommitted changes in my worktree that need to be stashed before I can do a rebase so I do something…
So many times once I’ve learned how to do something, I’ll find myself doing it but maybe not fully understanding what I’m doing. Ruby class method definitions are one of these things for me; I do it all the time but it wasn’t until recently that a light bulb went of and I reached a deeper understanding of what I was REALLY doing. Here is that journey, which started with looking for a way to stub…
I’ve recently been doing a lot more pair programming than I have ever done. Most times we will be sharing a branch and will switch drivers by committing some code so the new driver can pull it down and take over. This works great, but it can start to lead to a messy commit history. After much experimentation I really like our current workflow and thought I’d share it! There are things here that…
In search of a good way to update existing data in a mature Rails application There have been many times where I’ve encountered the need to change some data in response to a change our application. As the project and team I’ve been working on have grown the need for a robust method to run these data migrations has as well. What I’m referring to as a “data migration” is just some code that makes…
Learn to program using (mostly free) resources available online There are so many wonderful resources that are available to someone who is wanting to enter the world of being a programmer. But sometimes it can be daunting to know what is good, where to start, and what kind of path to follow through these resources. When I was just beginning to get interested programming, I didn’t have the funds or…
You could hear no breeze in the tops of the trees bordering the edge of this 5 acre plot. The only motion in the atmosphere around seemed to be the waves of heat rolling off of any exposed surface, distorting the visible edge of everything so that we seemed almost in a hazy dream land. My hands moved automatically performing one of several yearly adjustments on the grapevine in front of me;…
CanCan has been an awesome standby for authorization in many of the projects I’ve been involved with; but I’ve had my eye on Pundit and really appreciate the ‘just plain old Ruby objects’ approach. So on a couple of recent projects I made the jump. So far, it’s been awesome; but that’s a post for another day :-). One of the first challenges that I ran into was developing a strategy for testing my…