RubyFlow The Ruby and Rails community linklog

×

The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

Submit a post

You can use basic HTML markup (e.g. <a>) or Markdown.
Note that your post may be edited to suit the format of the site.

As you are not logged in, you will be
directed via GitHub to signup or sign in

Post Preview

Note: Only the first pargraph is shown on the front page and overly long paragraphs may be broken up.

Using ActiveRecord's #update_counters to Prevent Race Conditions

Race conditions are arguably the most insidious kind of bug; they’re intermittent, subtle, and most likely to occur in production. ActiveRecord’s update_counter provides us with a convenient way to avoid race conditions when incrementing or decrementing values in the database. In this article, Jonathan Miles shows us how to use it, how it’s implemented, and other approaches to avoiding race conditions. https://www.honeybadger.io/blog/activerecord-update-counters-race-conditions/

Powerful Emacs Snippets

In this post, I documented the process of customizing one of my Ruby snippets to have some code expanded conditionally. I used Emacs, but the general idea may apply to snippet packages of other editors. [more inside]

Webpack ALL The Assets

With the release of Rails 6, Webpack was introduced as the default JavaScript bundler by using the Webpacker gem. We tend to think about Webpack only as a tool to handle JavaScript files, but it can be used to handle all kinds of asset files. This article shows how to create a Rails app that uses only Webpack to handle all the assets, including images, fonts, styles and videos. [more inside]

How to ignore Bullet in RSpec tests

The Bullet gem is an excellent tool for finding opportunities to improve how you grab data via ActiveRecord. On a recent project, we’ve been running Bullet in our test environment as well as development. It has helped us find some improvements to areas of the app we rarely hit when developing new features. [more inside]

Loading older posts