Best of RailsApril 2025

  1. 1
    Article
    Avatar of hnHacker News·1y

    antiwork/gumroad

    The post provides a comprehensive guide on setting up a development environment for the 'antiwork/gumroad' project. It includes installation instructions for necessary dependencies like Ruby, Docker, MySQL, ImageMagick, libvips, FFmpeg, PDToolkit, Bundler, dotenv, and npm. The guide also covers creating SSL certificates, starting Docker services, and running the application along with Rails, a JavaScript build system, and Sidekiq worker. Additional setup steps like reindexing Elasticsearch and configuring git hooks are included.

  2. 2
    Article
    Avatar of rubylaRUBYLAND·1y

    Fix N+1 Queries Without Eager Loading Using SQL Subquery

    Learn how to address the N+1 query problem in Rails without resorting to eager loading. By leveraging SQL subqueries, you can fetch specific associated records directly within your main query, reducing memory consumption and improving performance. The post walks through a real-world example of fetching a member's latest activity timestamp efficiently, discussing various approaches and their trade-offs before demonstrating the optimal SQL subquery solution.

  3. 3
    Article
    Avatar of rubylaRUBYLAND·1y

    Boolean vs Datetime

    The post discusses refactoring an application to replace a boolean column used for tracking published statuses with a datetime column, providing improved functionality and flexibility.

  4. 4
    Article
    Avatar of rubylaRUBYLAND·1y

    Resize Observer API with Stimulus

    Learn how to use the Resize Observer API with Stimulus to track and respond to element size changes effectively. This guide covers the basics of the API, its integration with Stimulus, and various practical examples, including layout adjustments, adaptive components, and responsive charts. Key differences between Resize Observer and CSS media or container queries are also discussed, along with best practices for optimal performance.