Skip to main content
thoughtbot thoughtbot
  • Live on Twitch!

    thoughtbot is livestreaming

    Work alongside the thoughtbot team as we collaborate with each other and our clients, live. Ask us anything, we're live right now!

  • Case Studies
  • Blog
  • Let’s Talk
Live on Twitch!

thoughtbot is livestreaming

Work alongside the thoughtbot team as we collaborate with each other and our clients, live. Ask us anything, we're live right now!

Let’s get started!
View all Services
Development
  • Ruby on Rails
  • Hotwire
  • AI and Machine Learning
  • Maintenance
  • Mobile
Design
  • Discovery Sprints
  • UX, UI, and Product Design
  • Design Systems
Product
  • MVP
  • Product Management
  • Accessibility
Team and Processes
  • Team Augmentation
  • Fractional Leadership
View all Services
View all Resources
Development
  • Tech Leadership Resources
  • Open Source
  • Books
  • The Bike Shed Podcast
  • Live Streaming on YouTube
  • Conference Talks
The business of great software
  • Playbook
  • Purpose Built
  • Giant Robots Smashing Into Other Giant Robots Podcast
  • Design Sprint Guide
  • Live Streaming on LinkedIn
View all Resources

Active Record Articles

Written by thoughtbot, your expert partner for design and development.

    • All Topics
    • Design
    • Development
    • Product
    • More topics
  1. How fast can an ActiveRecord SQL query run?

    You have a SQL query that seems like it needs to be faster. What’s the upper-bound on improving that query’s performance?

    Fritz Meissner
    March 31, 2025
    • Rails
    • Active Record
    • Performance
  2. ActiveRecord query log tags for GraphQL

    ActiveRecord query log tags is my pick for most underrated Rails config option that isn’t enabled by default. Here’s how to extend it beyond the default options, with a specific example of GraphQL.

    Fritz Meissner
    March 18, 2025
    • Active Record
    • Rails
    • GraphQL
  3. Finding the opposite of what you have with rails invert_where

    Need to fetch the opposite data for an existing ActiveRecord query? Rails invert_where makes it effortless, but be careful with the side effects.

    Trésor Bireke
    March 14, 2025
    • Active Record
    • Ruby
    • Rails
    • Development
  4. This week in #dev (Aug 9, 2024)

    Renaming keys in a Hash, sanitizing input for a LIKE query, and toggling attributes in Rails.

    thoughtbot
    August 20, 2024
    • This Week In Dev
    • Rails
    • Ruby
    • Active Record
  5. Enum validations and database constraints in Rails 7.1

    How to add model validation for a column using a PostgreSQL enum type in Rails 7.1.

    Sally Hall
    April 16, 2024
    • Web
    • Rails
    • Active Record
    • Databases
    • Validation
    • Enum
  6. Are your polymorphic relationships correctly enforced?

    Learn how to strike a balance between flexibility and data integrity with a partial index and validations.

    Steve Polito
    December 1, 2023
    • Web
    • Rails
    • PostgreSQL
    • Active Record
  7. What's a counter cache?

    Running a separate query to count how many records are associated with another record is inefficient. Using a counter cache can save the day!

    Jose Blanco
    November 21, 2023
    • Rails
    • Ruby
    • Web
    • Active Record
    • Good Code
  8. Building Value Objects in Rails with composed_of

    Learn how to improve the interface of your existing Active Record Models with this underutilized API.

    Steve Polito
    July 20, 2023
    • Rails
    • Ruby
    • Web
    • Active Record
    • Good Code
  9. Are you absolutely sure your `has_one` association really has one association?

    Learn about an unexpected limitation with this API and how to combat it universally.

    Steve Polito
    June 5, 2023
    • Rails
    • PostgreSQL
    • Active Record
  10. This week in #dev (Mar 24, 2023)

    It’s all about databases in this edition!

    thoughtbot
    April 7, 2023
    • This Week In Dev
    • Active Record
    • PostgreSQL
    • Databases
  11. Sign up to receive a weekly recap from thoughtbot

    Looking for even more ways to stay connected?
    RSS feed icon Check out our feeds
1 2 Next › Last »

Footer

thoughtbot
  • Services
  • Case Studies
  • Resources
  • Let's Talk
  • Our Company
  • Careers
  • Purpose
  • Blog
  • Sponsor
  • Mastodon
  • Bluesky
  • GitHub
  • YouTube
  • Twitch
  • Feeds
© 2025 thoughtbot, inc.

The design of a robot and thoughtbot are registered trademarks of thoughtbot, inc.

  • US: +1 (877) 9-ROBOTS
  • UK: +44 (0)20 3807 0560
  • Beware of fraudulent thoughtbot job listings Learn more
  • Code of Conduct
  • Accessibility Statement
  • Privacy Policy