Resetting your Elasticsearch indices on heroku staging when you've reached the maximum index count for the current plan

posted in fixes

 

If you’ve ever used Heroku’s low cost staging plan for Bonsai Elasticsearch you may have ran into the following error: reached maximum index count for current plan.

Since in most cases your staging indices aren’t as critical as say production (don’t use the fix below in production, please!), you can safely follow the procedure below for removing and reindexing your search enabled models.

Lessons learned from using Capybara for feature testing

posted in articles

 

Having confidence in your application helps with the aid of great interation tests. For Rails, that means utilizing the Capybara gem for testing features from end-to-end.

While Capybara is a great gem for accomplishing this goal, it can be at time difficult, frustrating, and nuanced in its implementation. I’ve been keeping track of all the tricks I use reguarly and compiled a list of the best ones. Hopefully, this helps give some clarity to a few best practices I use on a daily basis.

Saving Script Output From Heroku to a Local File

posted in today i learned

 

Have you ever needed to gather a large amount of data from your production server but didn't have the script available on the server? You could remote into the server and write the script in rails console but what if the volume of data was in the hundreds of thousands? And you needed it in CSV format? Well, recently I recently discovered a great little command for gathering remote data and saving it to a local file.

How to validate attributes for serialized objects

posted in articles

 

Rail's out of the box validation feature set is fairly rich. You have the validates shortcut DSL which maps to all the default validators. The ability to override those default validators through custom validator classes. Finally, you can also write custom validator methods for specific use cases. For the purpose of this article, we'll focus on custom validator methods.

Jedi or Sith Lord: Ruby's inject method

posted in articles

 

"Remember, a Jedi's strength flows from the Force."

The ruby inject method is a powerful ally in a jedi (ruby) master's arsenal. It is wielded easily to those who train with it and mastered by a jedi with both knowledge of the light and dark side of the force. The light side of inject involves the different usages for the method as well as the basic format of it. The dark side involves inject's power using symbol#to_proc shortcut methods.

  • 1
  • 2
  • 3
  • 4
  • 5