# Hashrocket

Knowledge & news from us to you.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Testing Readonly Models

DevFeed: [Testing Readonly Models](<https://devfeed.tech/articles/testing-readonly-models-20120.md>)

Original publisher: [Read original article](<https://hashrocket.com/blog/posts/testing-readonly-models>)

Author: Tony Yunker

Published: 2026-03-17T13:00:00Z

Content type: tutorial

Language: en

Sources: [Hashrocket](<https://devfeed.tech/sources/hashrocket.md>)

Topics: [Rails](<https://devfeed.tech/topics/rails.md>), [Testing](<https://devfeed.tech/topics/testing.md>), [Ruby](<https://devfeed.tech/topics/ruby.md>), [Databases](<https://devfeed.tech/topics/databases.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [activerecord](<https://devfeed.tech/tags/activerecord.md>), [code](<https://devfeed.tech/tags/code.md>), [database](<https://devfeed.tech/tags/database.md>), [rails](<https://devfeed.tech/tags/rails.md>), [ruby](<https://devfeed.tech/tags/ruby.md>), [ruby-on-rails](<https://devfeed.tech/tags/ruby-on-rails.md>), [testing](<https://devfeed.tech/tags/testing.md>)

### AI overview

A Rails tutorial explains how to test readonly models that normally reject database writes. It proposes a narrowly scoped test-only override that temporarily permits persistence during setup and restores readonly behavior before the test runs.

### Source excerpt

I was working with a readonly model in Rails the other day and ran into an issue whilst testing it. Here's what I ran into and the solution I came up with. Readonly models are a great way to signal that, well, you should only ever read them, not write them. Maybe you have some external system that connects to the database for writes, or maybe your Rails app connects to some data warehouse for some queries or reports. It's can be useful to have a safeguard to prevent accidental errant writes. It's actually really simple to make a model readonly, you just need to override the readonly? method: class ReadOnlyPost < ApplicationRecord def readonly? = true end Now any attempt to create/save/update/delete a ReadOnlyPost will raise a friendly ActiveRecord::ReadOnlyRecord exception. The Problem You might be able to see where this is going. For any tests that can avoid saving this readonly model to the database, (i.e. using ReadOnlyPost.new or FactoryBot.build), then we're all good. But often tests need to persist some records to the test database. And if I try to create a ReadOnlyPost, I'm going to have a bad time. RSpec.describe ReadOnlyPost, type: :model do let(:post) { ReadOnlyPost.create(title: "Title", body: "body") } it "can create a post" do expect(post).to be_a(ReadOnlyPost) end end % bundle exec rspec F Failures: 1) ReadOnlyPost can create a post Failure/Error: let(:post) { ReadOnlyPost.create(title: "Title", body: "body") } ActiveRecord::ReadOnlyRecord: ReadOnlyPost is marked as readonly # ./spec/models/read_only_post_spec.rb:4:in `block (2 levels) in <top (required)>' # ./spec/models/read_only_post_spec.rb:7:in `block (2 levels) in <top (required)>' This makes sense, the readonly property of the model doesn't go away in test - creating a record is creating a record is writing to the database, so it will fail. The Solution What we want to do is override this constraint to temporarily allow us to persist data. Ideally, we do this very narrowly to not impact the syst

## Crafting Code: Building a Ruby Pattern Generator for a Crochet Circle

DevFeed: [Crafting Code: Building a Ruby Pattern Generator for a Crochet Circle](<https://devfeed.tech/articles/crafting-code-building-a-ruby-pattern-generator-for-a-crochet-circle-20114.md>)

Original publisher: [Read original article](<https://hashrocket.com/blog/posts/crafting-code-building-a-ruby-pattern-generator-for-a-crochet-circle>)

Author: Mary Lee

Published: 2026-01-20T14:00:00Z

Content type: tutorial

Language: en

Sources: [Hashrocket](<https://devfeed.tech/sources/hashrocket.md>)

Topics: [Ruby](<https://devfeed.tech/topics/ruby.md>), [Parsing](<https://devfeed.tech/topics/parsing.md>), [Parser](<https://devfeed.tech/topics/parser.md>), [Code](<https://devfeed.tech/topics/code.md>), [coding](<https://devfeed.tech/topics/coding.md>)

Tags: [building](<https://devfeed.tech/tags/building.md>), [code](<https://devfeed.tech/tags/code.md>), [coding](<https://devfeed.tech/tags/coding.md>), [parsing](<https://devfeed.tech/tags/parsing.md>), [patterns](<https://devfeed.tech/tags/patterns.md>), [project](<https://devfeed.tech/tags/project.md>), [ruby](<https://devfeed.tech/tags/ruby.md>), [side-projects](<https://devfeed.tech/tags/side-projects.md>)

### AI overview

This tutorial describes building a Ruby class that generates crochet circle patterns. It explains how crochet rounds are formatted, how stitch abbreviations and counts reveal repeated increases, and how those patterns can be parsed and modeled in code.

### Source excerpt

In my time as a developer, I have noticed that one of the most common ways my coworkers spend time coding outside of work is by developing little code snippets or apps that solve problems in their everyday lives. From household budgeting, to managing workouts on rowing machines, to generating a Taco Bell order, these projects allow devs to explore different coding styles and learn new technologies. For a long time, most of my side projects have been for the sole purpose of learning a new technology. When I wanted to start building mobile apps with React Native, I wrote a small to-do app that, once finished, I abandoned. The same thing happened when I wanted to try to use PostgreSQL's listen and notify feature to build a live updating chat app. So, when I was thinking about a new side project, I decided it was time to work on something that could be long lived and help me with one of my favorite hobbies: crocheting. The Premise Recently, I've been making a lot of small projects that have started with a base shape that then gets built upon. Often, this shape is a circle. After running through several projects, I started to notice a pattern of increases and repetitions for each row. It occurred to me that if the shape followed a specific pattern, I could probably build a ruby class to generate that pattern. Thus began this side project! Breaking Down a Simplified Pattern To begin, we have to inspect the pattern. Crochet patterns follow a specific format, and use abbreviations for the types of stitches being used. The example pattern uses the following abbreviations and rules: Abbreviation Meaning Use Stitch Count sc single crochet adds a stitch to the round 1 inc increase (two single crochets in the same stitch) adds an extra stitch to the round 2 With those abbreviations in mind, we can start parsing the pattern. R1: 6sc in magic ring (6) R2: [inc] x6 (12) R3: [sc, inc] x6 (18) R4: sc, inc, [2sc, inc] x5, sc (24) R5: [3sc, inc] x6 (30) R6: 2sc, inc, [4sc, inc] x5, 2sc

## Building a (Very) Simple Responsive Search with Rails & Stimulus

DevFeed: [Building a (Very) Simple Responsive Search with Rails & Stimulus](<https://devfeed.tech/articles/building-a-very-simple-responsive-search-with-rails-stimulus-20113.md>)

Original publisher: [Read original article](<https://hashrocket.com/blog/posts/building-a-simple-search-with-rails-stimulus>)

Author: Jack Rosa

Published: 2025-12-09T14:00:00Z

Content type: tutorial

Language: en

Sources: [Hashrocket](<https://devfeed.tech/sources/hashrocket.md>)

Topics: [Rails](<https://devfeed.tech/topics/rails.md>), [Stimulus](<https://devfeed.tech/topics/stimulus.md>), [Framework](<https://devfeed.tech/topics/framework.md>)

Tags: [building](<https://devfeed.tech/tags/building.md>), [hotwire](<https://devfeed.tech/tags/hotwire.md>), [rails](<https://devfeed.tech/tags/rails.md>), [search](<https://devfeed.tech/tags/search.md>), [side-project](<https://devfeed.tech/tags/side-project.md>), [stimulus](<https://devfeed.tech/tags/stimulus.md>), [turbo](<https://devfeed.tech/tags/turbo.md>)

### AI overview

A tutorial for building a responsive search form with Rails and Stimulus. It demonstrates debounced input submission, a clear-input button, and updating search results inside a Turbo Frame without a full-page reload.

### Source excerpt

Here's a simple and responsive search form I put together for a recent side project, using Hotwire's Stimulus framework and Rails with Turbo. The Form Here's how the search input looks. It's a simple search form connected to a Stimulus controller. The input triggers the search function upon every input event. The debounce logic occurs in the Stimulus controller to make sure not too many requests are made to the server: <%= form_with url: items_path, method: :get, data: { controller: "search", turbo_frame: "items_list" } do |f| %> <%= f.text_field :query, placeholder: "Search...", data: { search_target: "input", action: "input->search#search" } %> <button type="button" class="hidden" data-search-target="clearButton" data-action="click->search#clear"> x </button> <% end %> There's an additional feature here: a button which appears in the search field whenever the field has a value. The button has a data-action attribute pointing to the clear action. If the button is clicked, the input value is cleared out. The Stimulus Controller All we need to do here is submit the form with a debounce timer, handle the action for clicking the clear input button, and handle hiding the clear button if the input field has a value or not. export default class extends Controller { static targets = ["input", "clearButton"] connect() { this.toggleClear() } search() { this.toggleClear() clearTimeout(this.timeout) this.timeout = setTimeout(() => { this.element.requestSubmit() }, 300) } clear() { this.inputTarget.value = "" this.toggleClear() this.element.requestSubmit() } toggleClear() { if (this.inputTarget.value.length > 0) { this.clearButtonTarget.classList.remove("hidden") } else { this.clearButtonTarget.classList.add("hidden") } } } The Turbo Frame You'll notice the form targets an items_list turbo frame, which contains your search results in the view. When the Stimulus controller submits the form, the content inside this frame gets replaced with the new search results. This is a pretty

## Creating a Custom Mobile Integration for a Board Game Using Ruby on Rails

DevFeed: [Creating a Custom Mobile Integration for a Board Game Using Ruby on Rails](<https://devfeed.tech/articles/creating-a-custom-mobile-integration-for-a-board-game-using-ruby-on-rails-20115.md>)

Original publisher: [Read original article](<https://hashrocket.com/blog/posts/creating-a-custom-mobile-integration-for-a-board-game-using-ruby-on-rails>)

Author: Craig Hafer

Published: 2025-12-04T14:00:00Z

Content type: tutorial

Language: en

Sources: [Hashrocket](<https://devfeed.tech/sources/hashrocket.md>)

Topics: [board-game](<https://devfeed.tech/topics/board-game.md>), [Ruby on Rails](<https://devfeed.tech/topics/ruby-on-rails.md>), [Mobile](<https://devfeed.tech/topics/mobile.md>), [Tailwind CSS](<https://devfeed.tech/topics/tailwind.md>), [Database](<https://devfeed.tech/topics/database.md>), [Stimulus](<https://devfeed.tech/topics/stimulus.md>)

Tags: [board-game-app](<https://devfeed.tech/tags/board-game-app.md>), [mobile](<https://devfeed.tech/tags/mobile.md>), [postgresql](<https://devfeed.tech/tags/postgresql.md>), [rails](<https://devfeed.tech/tags/rails.md>), [ruby](<https://devfeed.tech/tags/ruby.md>), [ruby-on-rails](<https://devfeed.tech/tags/ruby-on-rails.md>), [stimulus](<https://devfeed.tech/tags/stimulus.md>), [tailwind](<https://devfeed.tech/tags/tailwind.md>)

### AI overview

A tutorial on building a mobile version of the Analyzer mechanism from the 1973 Parker Brothers board game Billionare. The project uses Ruby on Rails, Tailwind, PostgreSQL, and Stimulus, with the goal of supporting a broader library of board game helpers.

### Source excerpt

Picture this: you find a charming old board game at a garage sale, bring it home, gather some friends--and snap. The 50-year-old plastic components break instantly. You search the web for help to replace this fun and unique game mechanic but there's nothing to be found. So naturally, you roll up your sleeves and build your own mobile version. No one else does this? Just me? Well, in case you ever find yourself in a similar boat, I figured I would walk you through what I did when building my own mobile integration to the 1973 Parker Brothers classic Billionare. As I said, right when I went to try out this cool "new" board game for the first time, the plastic ends of the Analyzer snapped. The analyzer is basically a plastic rod with 2 floating spinners on them. The spinners, when rotated, will either land with a red face or a green face. You then refer to the chart to see what action to take. I thought this was such a unique way to give a random effect in a game, without relying on dice. It essentially is just a random binary spinner that counts up to 4. Here is what it looks like for reference: So, without any 4 sided die lying around, and not wanting to use a boring random number generator, my brain went right to what it knows best---Ruby on Rails. So without further ado, here's what I did and how you can do something similar yourself. Creating the app Sure, Rails could be considered overkill for such a simple app. But my idea is to allow this project to scale into a whole library of board game helpers that can all live within the same app. So, to start off I ran the old trusty rails new command, with a couple preferences I like to pass in to make my life easier as a developer. rails new board_game_library --css tailwind --database=postgresql One of the main tools I leveraged for this project besides Rails was Tailwind. Tailwind makes styling so easy. Here at Hashrocket Tailwind is pretty standard for all of us, so if you're interested in any tips or tricks, we have

## Why Ruby Is Well Suited for Advent of Code

DevFeed: [Why Ruby Is Well Suited for Advent of Code](<https://devfeed.tech/articles/why-ruby-is-the-best-language-for-advent-of-code-20121.md>)

Original publisher: [Read original article](<https://hashrocket.com/blog/posts/why-ruby-is-the-best-language-for-advent-of-code>)

Author: Tony Yunker

Published: 2025-12-02T14:00:00Z

Content type: opinion

Language: en

Sources: [Hashrocket](<https://devfeed.tech/sources/hashrocket.md>)

Topics: [Advent of Code](<https://devfeed.tech/topics/advent-of-code.md>), [Ruby](<https://devfeed.tech/topics/ruby.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [Data structures](<https://devfeed.tech/topics/data-structures.md>)

Tags: [advent-of-code](<https://devfeed.tech/tags/advent-of-code.md>), [data-structures](<https://devfeed.tech/tags/data-structures.md>), [programming](<https://devfeed.tech/tags/programming.md>), [ruby](<https://devfeed.tech/tags/ruby.md>), [standard-library](<https://devfeed.tech/tags/standard-library.md>), [tooling](<https://devfeed.tech/tags/tooling.md>)

### AI overview

This opinion article explains why the author prefers Ruby for Advent of Code programming puzzles, highlighting Ruby's flexibility, data structures, standard library, and tooling. It also notes that Ruby's metaprogramming can cause bugs in larger production codebases.

### Source excerpt

It's the most wonderful time of the year - Christmas Advent of Code time! Advent of Code is an Advent Calendar style series of programming puzzles put out each year, starting on December 1st leading up to Christmas. The puzzles are super festive and ramp up in difficulty over the course of the month. Programmers of every level can participate, and in researching some of the more difficult problems you'll probably learn something cool! It's a great way to finish out the year. I've been taking part in Advent of Code since 2019 (I've never completed a full year - and that's ok! You can participate for as long as it's fun and have the time) and have tried solving in multiple different languages - Advent is a great way to learn/skill up in a new language. But Ruby remains my favorite language in which to solve these puzzles. Many of Ruby's strengths - its flexibility, robust standard library, and tooling make it the ideal language for Advent of Code. Flexibility Ruby doesn't enforce any one way of writing code. Want to solve a problem with a procedural script? Go for it! Want to leverage object-oriented programming and send messages between classes? Can do! Want to write in a functional style and map and zip a data structure in one long chain? You can do that too! And you can mix and match paradigms between problems - whatever models each problem best. Ruby's data structures are super flexible as well. In many of the problems, Array and Hash allow you to very quickly model solutions. But if you find a hash isn't quite cutting it and you don't want to upgrade it to a full class, you can use the Data class to create value objects. This will lend you a bit more structure than a hash, and allow you to encapsulate some logic inside it without having to bring in the overhead of a Class. Some of Ruby's flexibility - metaprogramming in particular - can be...unpopular... in larger production codebases. It's the "magic" that can lead to some nasty bugs. But Advent is a great place

## How to Set Up rails-mcp-server for Rails Projects with MCP

DevFeed: [How to Set Up rails-mcp-server for Rails Projects with MCP](<https://devfeed.tech/articles/how-to-rev-up-your-rails-development-with-mcp-20116.md>)

Original publisher: [Read original article](<https://hashrocket.com/blog/posts/how-to-rev-up-your-rails-development-with-mcp>)

Author: Jack Rosa

Published: 2025-11-27T14:00:00Z

Content type: tutorial

Language: en

Sources: [Hashrocket](<https://devfeed.tech/sources/hashrocket.md>)

Topics: [Rails](<https://devfeed.tech/topics/rails.md>), [Model Context Protocol](<https://devfeed.tech/topics/model-context-protocol.md>), [MCP Server](<https://devfeed.tech/topics/mcp-server.md>), [Development](<https://devfeed.tech/topics/development.md>), [Ruby](<https://devfeed.tech/topics/ruby.md>), [Claude Code](<https://devfeed.tech/topics/claude-code.md>), [HTTP](<https://devfeed.tech/topics/http.md>), [JSON](<https://devfeed.tech/topics/json.md>), [Remote Procedure Call (RPC)](<https://devfeed.tech/topics/rpc.md>)

Tags: [ai](<https://devfeed.tech/tags/ai.md>), [claude-code](<https://devfeed.tech/tags/claude-code.md>), [development](<https://devfeed.tech/tags/development.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [http](<https://devfeed.tech/tags/http.md>), [json](<https://devfeed.tech/tags/json.md>), [mcp](<https://devfeed.tech/tags/mcp.md>), [mcp-server](<https://devfeed.tech/tags/mcp-server.md>), [rails](<https://devfeed.tech/tags/rails.md>), [rpc](<https://devfeed.tech/tags/rpc.md>), [ruby](<https://devfeed.tech/tags/ruby.md>)

### AI overview

This tutorial explains how to install and configure the rails-mcp-server Ruby gem so AI agents such as Claude Code can interact with Rails projects through the Model Context Protocol. It covers global installation, project configuration, HTTP mode, JSON-RPC and SSE endpoints, and Claude Code integration.

### Source excerpt

Shipping new features on legacy Rails applications requires deep codebase context. The rails-mcp-server gem closes the gap between AI agents and your Rails projects, enabling more relevant code analysis and context aware refactoring suggestions. Whether you're dealing with tech debt in a brownfield application or building new greenfield features, this tool can help you move faster with confidence. The Model Context Protocol (MCP) is a way to allow LLM models to interact with development environments and external tools. The rails-mcp-server gem is a Ruby implementation that enables LLMs to interact directly with Rails projects through MCP; Once you have it set up with an agent like claude or copilot, the model will have way more context about your app's architecture and removes a lot of the nonsense and guesswork associated with AI driven development. Check out the repo here I'll walk you through setting up the rails-mcp-server gem for your Rails projects. Installation Installing the rails-mcp-server gem is simple like any ruby gem. Open your terminal and run. Don't install it to your project's directory or add it to a Rails gemfile, this gem is meant to be installed globally and configured to run with multiple projects. gem install rails-mcp-server Config Setting Up Your Projects Once you run the server for the first time, you can configure the gem to access your rails projects. The configuration location depends on your operating system: macOS: $XDG_CONFIG_HOME/rails-mcp or ~/.config/rails-mcp if XDG_CONFIG_HOME is not set Windows: %APPDATA%\rails-mcp The first time the server runs, these directories will be created. Running the Rails MCP Server The server can be ran in two modes, but for the purposes of this article we will stick to http mode, if you want to find out about STDIO mode check out the docs here. Running the server will create the config directory. HTTP Mode HTTP mode runs as an HTTP server with JSON-RPC and Server-Sent Events (SSE) endpoints, perfect

## Building a MCP Server in Elixir

DevFeed: [Building a MCP Server in Elixir](<https://devfeed.tech/articles/building-a-mcp-server-in-elixir-20112.md>)

Original publisher: [Read original article](<https://hashrocket.com/blog/posts/building-a-mcp-server-in-elixir>)

Author: Vinicius Negrisolo

Published: 2025-11-25T14:00:00Z

Content type: tutorial

Language: en

Sources: [Hashrocket](<https://devfeed.tech/sources/hashrocket.md>)

Topics: [MCP Server](<https://devfeed.tech/topics/mcp-server.md>), [Model Context Protocol](<https://devfeed.tech/topics/model-context-protocol.md>), [Elixir](<https://devfeed.tech/topics/elixir.md>), [API](<https://devfeed.tech/topics/api.md>), [Tool](<https://devfeed.tech/topics/tool.md>), [Documentation](<https://devfeed.tech/topics/documentation.md>)

Tags: [ai](<https://devfeed.tech/tags/ai.md>), [api](<https://devfeed.tech/tags/api.md>), [building](<https://devfeed.tech/tags/building.md>), [development](<https://devfeed.tech/tags/development.md>), [documentation](<https://devfeed.tech/tags/documentation.md>), [elixir](<https://devfeed.tech/tags/elixir.md>), [mcp](<https://devfeed.tech/tags/mcp.md>), [mcp-server](<https://devfeed.tech/tags/mcp-server.md>), [model-context-protocol](<https://devfeed.tech/tags/model-context-protocol.md>), [process](<https://devfeed.tech/tags/process.md>), [tool](<https://devfeed.tech/tags/tool.md>)

### AI overview

A practical guide to building an MCP server in Elixir for a TIL website. The project uses Anubis to expose a tool that creates TIL posts from AI tooling, with detailed tool and input descriptions to help the AI map requests to the expected schema.

### Source excerpt

We've been working with MCP servers for a while, and this use case was a perfect opportunity to build out another one. What is an MCP Server? A very simple way to put it is that Model Context Protocol is an "API" that your AI tooling can use to get external data or perform actions by interacting with your application. If it's just an API, that seems very easy to implement. Let's think about our use case then. The Use Case The project is the TIL https://til.hashrocket.com/ website where we developers usually write about our own learning experiences throughout small TIL posts. So our idea with the MCP server was to provide a way to simply create a TIL post from inside our AI tooling, and then maybe go to the TIL site and refine that idea. These days we spend a lot of time inside our AI tools asking the most variety of questions, and we end up learning something from those interactions. Eventually, if we learn from an AI chat interaction, we'd like to just grab that content and maybe scaffold it into a new TIL post. This was the starting point of the project, and with that we started to take a look into libraries to achieve that. We found out that there were 2 libraries that were both forks of each other: Hermes MCP Anubis MCP We played around a bit with Hermes but we ended up using Anubis in the end. I have to say it was a bit of a bumpy road. The documentation for both was not the best - we had some situations where the documentation was outdated or just simply not working - so follow our steps here if you want to setup an MCP server yourself. MCP Server The first component to write is an MCP server, which is very simple. For now it's just: defmodule Tilex.MCP.Server do use Anubis.Server, name: "TIL", version: "1.0.0", capabilities: [:tools] component(Tilex.MCP.NewPost) end MCP Tools So the first tool we made was to create a TIL Post: defmodule Tilex.MCP.NewPost do @moduledoc """ Create a new TIL ("Today I Learned") post. TIL is a place for sharing something you've l

## Speed Up Your Rails App by Squashing N+1 Queries

DevFeed: [Speed Up Your Rails App by Squashing N+1 Queries](<https://devfeed.tech/articles/speed-up-your-rails-app-by-squashing-n-1-queries-20119.md>)

Original publisher: [Read original article](<https://hashrocket.com/blog/posts/speed-up-your-rails-app-by-squashing-n-1-queries>)

Author: Tony Yunker

Published: 2025-11-20T14:00:00Z

Content type: tutorial

Language: en

Sources: [Hashrocket](<https://devfeed.tech/sources/hashrocket.md>)

Topics: [Rails](<https://devfeed.tech/topics/rails.md>), [Databases](<https://devfeed.tech/topics/databases.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [activerecord](<https://devfeed.tech/tags/activerecord.md>), [code](<https://devfeed.tech/tags/code.md>), [database](<https://devfeed.tech/tags/database.md>), [performance](<https://devfeed.tech/tags/performance.md>), [rails](<https://devfeed.tech/tags/rails.md>), [ruby-on-rails](<https://devfeed.tech/tags/ruby-on-rails.md>)

### AI overview

This tutorial explains how N+1 queries arise in Rails applications when associated ActiveRecord records are accessed during iteration. It uses nested authors, posts, and tags as a case study, showing how eager loading can reduce a workload from 1,101 database queries to 3.

### Source excerpt

N+1 queries are one of the most common performance killers in Rails apps, but also one of the easiest to fix. In this post, we'll see how a single line of code can reduce 1,101 database queries down to 3. N+1s occur in rails when you have associated ActiveRecord models, and iterate over one model while accessing fields on the associated records. This might be easier to explain with an example. Let's say you have the following ActiveRecord models: class Author < ApplicationRecord has_many :posts end class Post < ApplicationRecord belongs_to :author has_many :tags end class Tag < ApplicationRecord belongs_to :post end An author has many posts, and each post can have many tags. If we want to list each author and their blog posts like below, then we'll make 1 query to the database for the authors, and then another query for each author's blog posts. For N authors, that's 1 + N queries to the database. Author.take(3).each do |author| puts author.name author.posts.each do |post| puts post.title end end We can see all the queries in the logs - 1 query for authors, then 3 queries for each author's blog posts: Author Load (31.4ms) SELECT "authors".* FROM "authors" Post Load (2.4ms) SELECT "posts".* FROM "posts" WHERE "posts"."author_id" = 163 Post Load (0.4ms) SELECT "posts".* FROM "posts" WHERE "posts"."author_id" = 164 Post Load (0.1ms) SELECT "posts".* FROM "posts" WHERE "posts"."author_id" = 165 In small doses this isn't a big deal - these are small, quick queries. However, as soon as the data gets larger, the queries more complex, or the cardinality of these queries grow, then things can really slow down. Let's look at a case study, where we start with an unoptimized query with 2 layers of N+1s, and see how much faster we can make it. Case 1 - The Unoptimized Query Let's take the example above, and add another layer to it. On our authors index page, we want to list each author, then each of their blog posts, including their associated tags. With a totally unoptimized qu

## Claude Code's Context Access and Terminal Workflow

DevFeed: [Claude Code's Context Access and Terminal Workflow](<https://devfeed.tech/articles/some-thoughts-about-claude-code-20118.md>)

Original publisher: [Read original article](<https://hashrocket.com/blog/posts/some-thoughts-about-claude-code>)

Author: Jack Rosa

Published: 2025-11-18T14:00:00Z

Content type: opinion

Language: en

Sources: [Hashrocket](<https://devfeed.tech/sources/hashrocket.md>)

Topics: [Claude Code](<https://devfeed.tech/topics/claude-code.md>), [Claude](<https://devfeed.tech/topics/claude.md>), [Terminal](<https://devfeed.tech/topics/terminal.md>), [Bash](<https://devfeed.tech/topics/bash.md>)

Tags: [ai](<https://devfeed.tech/tags/ai.md>), [bash](<https://devfeed.tech/tags/bash.md>), [claude](<https://devfeed.tech/tags/claude.md>), [claude-code](<https://devfeed.tech/tags/claude-code.md>), [context](<https://devfeed.tech/tags/context.md>), [hallucinations](<https://devfeed.tech/tags/hallucinations.md>), [permission](<https://devfeed.tech/tags/permission.md>), [rails](<https://devfeed.tech/tags/rails.md>), [ruby](<https://devfeed.tech/tags/ruby.md>), [terminal](<https://devfeed.tech/tags/terminal.md>), [workflow](<https://devfeed.tech/tags/workflow.md>)

### AI overview

An opinion article assessing Claude Code's codebase context access, permission workflow, data-handling considerations, and terminal-based verification capabilities. It advises developers to review proposed actions critically because the tool can hallucinate.

### Source excerpt

Claude code is a powerful AI toolset that runs right in your terminal. While providing a lot of impressive utility, it also suffers from the issues that arise from similar AI toolings with the addition of an expensive pricing model. Context is Important To me, the main selling point for Claude Code is its ability to read through your entire codebase; a big shortcoming of many AI workflows is the model only partially understanding an issue due to it not having enough of the project's context and convention to be effective. Claude Code has the ability to access all of the files in the directory where you initiated the session, and can even ask for permission to search through extraneous directories. While potentially helpful, this is also a little sketchy when considering that everything Claude is processing is getting sent over the wire to Anthropic's servers; according to their privacy policy, the data sent over for processing will not be used for LLM training unless the user specifically opts in or the content has been flagged for a Trust & Safety Review. It's also important to be aware that Claude's data retention policy has changed in recent months and will likely continue to change. Step by Step When you start a Claude Code session and give it a task to complete, it will usually try to break down the task into steps to complete. Upon starting a 'step', Claude will show you what it wants to do, and ask you for permission to do it. In my experience, I always had three options when presented with Claude's suggestion: accept the suggested action, always accept the suggested action, or do not accept and tell Claude to do something different. I would urge any developer to stick to the first and last option. Take the time to look at Claude's suggestion critically and decide if it seems like the right way to go. Claude is usually logical, but also susceptable to hallucinations. A big advantage of Claude Code living in the terminal, is that it has the ability to run bash

## Nativewind: Speeding up Styling in React Native

DevFeed: [Nativewind: Speeding up Styling in React Native](<https://devfeed.tech/articles/nativewind-speeding-up-styling-in-react-native-20117.md>)

Original publisher: [Read original article](<https://hashrocket.com/blog/posts/nativewind-speeding-up-styling-in-react-native>)

Author: Jack Rosa

Published: 2025-11-13T14:00:00Z

Content type: tutorial

Language: en

Sources: [Hashrocket](<https://devfeed.tech/sources/hashrocket.md>)

Topics: [React Native](<https://devfeed.tech/topics/react-native.md>), [Tailwind CSS](<https://devfeed.tech/topics/tailwind.md>), [Mobile](<https://devfeed.tech/topics/mobile.md>), [Expo](<https://devfeed.tech/topics/expo.md>), [Babel](<https://devfeed.tech/topics/babel.md>), [Prettier](<https://devfeed.tech/topics/prettier.md>)

Tags: [babel](<https://devfeed.tech/tags/babel.md>), [css](<https://devfeed.tech/tags/css.md>), [init](<https://devfeed.tech/tags/init.md>), [install](<https://devfeed.tech/tags/install.md>), [mobile](<https://devfeed.tech/tags/mobile.md>), [react](<https://devfeed.tech/tags/react.md>), [react-native](<https://devfeed.tech/tags/react-native.md>), [tailwind](<https://devfeed.tech/tags/tailwind.md>), [tailwind-css](<https://devfeed.tech/tags/tailwind-css.md>), [tailwindcss](<https://devfeed.tech/tags/tailwindcss.md>)

### AI overview

A tutorial on using NativeWind to style React Native applications with Tailwind CSS classes. It explains NativeWind's runtime or Babel-plugin compile-time translation into React Native styles, and covers setup with Expo, Tailwind configuration, a global CSS file, and Babel.

### Source excerpt

How Nativewind can speed up your React Native Development If you're anything like me, after working on a few web projects with Tailwind, it can feel like a drag to return to stacks that use other styling libraries. Tailwind has become, for myself, and many other developers, a standard styling paradigm. When starting my most recent React Native project, I was relieved to find out that NativeWind exists. NativeWind is exactly what is sounds like: Tailwind Classes in React Native. I can attest to the breeziness of writing an entire native app without a single call to StyleSheet.create. It's Familiar Nativewind takes the familiar classes of Tailwind CSS directly to your React Native components. Virtually every* class from Tailwind CSS can be used the exact same way on your mobile app (and the web), and the development results end up being faster iteration, less translating, and components that feel more readable and maintainable. Let's look at how to set it up NativeWind translates Tailwind class names into React Native styles at runtime or compile-time, if you use the Babel plugin. You end up with the the same composable mindset of Tailwind, but the output is just React Native styles. The setup is simple enough, for my latest project we used expo: npx expo install nativewind react-native-reanimated@~3.17.4 react-native-safe-area-context@5.4.0 npx expo install --dev tailwindcss@^3.4.17 prettier-plugin-tailwindcss@^0.5.11 Now to generate a tailwind config, run: npx tailwindcss init Be sure to include the path to your components in the generated tailwind.config.js file /** @type {import('tailwindcss').Config} */ module.exports = { content: ["./App.tsx", "./components/**/*.{js,jsx,ts,tsx}"], presets: [require("nativewind/preset")], theme: { extend: {}, }, plugins: [], } Next create your global.css file with tailwind's directives @tailwind base; @tailwind components; @tailwind utilities; Then, enable the Babel plugin in babel.config.js: module.exports = function (api) { api