posts
Verify That an ActiveRecord Object has at Least One Attribute may 9, 2019

Rails ActiveRecord callbacks make validation a breeze, but what happens if you want to verify that a record has at least one attribute present, but you don’t care which attribute it is? This was a recent case I was working on for a client who was having their operators fill in a form with a lot of uncertainty. They couldn’t know which record would be needed, but we didn’t want to allow all records to be blank.

Learning Vim, the Long Way february 16, 2019

Vim has changed the way I work in a massive positive way, but I spent over a year giving up and coming back before it finally stuck. This is what worked for me.

2018
Re-associate ActiveStorage attachments after changing a table name april 26, 2018

Sometimes you have to change a table name. When you do, don’t forget to update ActiveStorage relationships otherwise your files will be orphaned.

Deleting ActiveStorage Attachments From the Controller, 3 Ways april 19, 2018

ActiveStorage in Rails 5.2 is awesome, but where do handle deleting attachments on the controller? Here are some possible options.

Retrieve Associated Parent Attributes from Child Record in Rails april 13, 2018

Calling attributes of associated records isn’t “directional”. Or, how I learned to stop worrying and love foreign keys.

Error Better: Effectively Utilize Active Model Errors with Rails in API Mode march 26, 2018

Go beyond delivering just full_messages in Rails to send well formatted error messages using Rails API

Using Font Awesome 5 in the Rails Asset Pipeline with Turbolinks february 26, 2018

Want to use Font Awesome 5 with the Rails Asset Pipeline and Turbolinks? Read on to find out what you need.

User authorization without cancan(can) february 21, 2018

Building custom user authorization that integrates into Devise’s current_user helper.