RSSAmplifier

Blog

Scott Bartell

A blog about Ruby, Rails, Software Performance, and Maintainability

scottbartell.comRSS feed ↗10 posts

Latest posts

Different Ways to Set Attributes in ActiveRecord (Rails 7)

Rails 7 has a rich API that allows you to update your ActiveRecord objects in several ways. Some methods have slightly different behavior which can sometimes result in unexpected consequences, so it’s important to understand their differences.

Exploring Ruby’s `clamp` and `minmax` methods

I came across an interesting problem recently where I was given a value and an array of “buckets” and I basically needed to return which bucket the value was closest to.

Finding and Fixing Missing Indexes in a Rails app

When looking at the “Most time consuming” database operations for our application in New Relic and I came across something that looked odd to me.

RSpec Rails Tip: `have_http_status` matcher

Sometimes you need to test the status code of a response in a controller, request, or feature spec. With the rspec-rails gem this can be done cleanly using the have_http_status matcher.

Capybara Tip: Current Path Matcher

Sometimes within a Capybara test you need to verify that you are on a particular page. The obvious way to test for this is by making expectations against current_path or current_url.

Capybara Tip: Disabling CSS Animations

You can disable CSS animations and transitions globally by setting the Capybara.disable_animation option.

Building a Sumo Logic Dashboard for a Rails App on Heroku

Note: The dashboard and graphs outlined in this article are simplified examples of what I have used successfully in a production environment in the past. You should modify the dashboard and queries to fit your application’s specific needs.

Different Ways to Set Attributes in ActiveRecord (Rails 6)

Rails 6 has a rich API that allows you to update your ActiveRecord objects in several different ways. Some methods have slightly different behavior which can sometimes result in unexpected consequences so it’s important to understand their differences.

Automating Rails Database Migrations on Heroku

One problem that teams tend to run into with Rails apps on Heroku is forgetting to run database migrations before the code that depends on them is released.

Different Ways to Set Attributes in ActiveRecord (Rails 5)

Rails 5 has a rich API that allows you to update your ActiveRecord objects in several different ways. Some methods have slightly different behavior which can sometimes result in unexpected consequences so it’s important to understand their differences.