It was a regular Monday morning. I was sipping coffee waiting to head into standup when I got a slack I messed up.... I accidentally ran User.update(admin: true) when trying to update my account, and updated every user in the system At first, disbelief, then, panic. Firefight mode starts. I spin up a database backup, generate a list for us...
If you’ve used PostgreSQL before with hstore. I’m sure you’ve come across this while running your migrations. PG::UndefinedObject: ERROR: type "hstore" does not exist Then you have to go into your database, enable hstore, but what if you rebuild the database? You run into that problem all over. The easiest and most reliable solution I’ve found, is...
I’ve been building a rails engine over the past couple of weeks. As I near completion, I wanted to make sure that my engine was compatible with multiple versions of Rails. The way that I found the easiest was outlined by Richard Schneeman (AKA schneems) in his blog post Testing Against Multiple Rails Versions His example was given for a gem,...
After pondering how to deal with conditional logic in Elasticsearch queries. I finally realized that the query DSL for Elasticsearch is just structured JSON. Which is why Ruby didn’t like when the syntax was messed up. Jbuilder to the rescue! Now with Jbuilder you can stick whatever you want in your queries. Conditional logic, loops, anything really. Here is what we...
At work I’ve been working on replacing our current product search (currently powered by a SaaS) with Elasticsearch. When I first started I set out to find what Ruby gem I should use on this project. I found a couple of very impressive gems, such as Search Kick, but unfortunately Search Kick currently doesn’t support Mongoid, so I kept looking....