Skip to content
Back to skills

Rails Knowledge Patch

ASecurity

Ruby on Rails

  • 25 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 5, 2026
developmentjavascriptrustgojavarubysqlrailsdockerazureapi

Works with

  • cursor
  • api

Security analysis

A100/100

Pro scans all 7 files and shows the line behind each finding

Scanned December 1, 2026

npx -y skills add Nevaberry/nevaberry-plugins --skill rails-knowledge-patch --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Rails Knowledge Patch?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Rails Knowledge Patch
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nevaberry-rails-knowledge-patch-nevaberry-plugins/badge)](https://www.skillsdirectory.com/skills/nevaberry-rails-knowledge-patch-nevaberry-plugins)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: rails-knowledge-patch
description: Ruby on Rails
version: "8.1.4"
license: MIT
metadata:
  author: Nevaberry
---


# Rails Knowledge Patch

Use this skill when upgrading Rails applications or working on databases,
background jobs, web responses, assets, storage, deployment, or diagnostics.
Load the reference matching the task for detailed conditions and examples.

| Reference | Topics |
| --- | --- |
| [Upgrading and compatibility](references/upgrading-and-compatibility.md) | Removed configuration and APIs, deprecators, caches, time, JSON, formatting |
| [Active Record and databases](references/active-record-and-databases.md) | Adapters, pools, migrations, schemas, transactions, shards, queries, associations, bulk writes |
| [Active Job and Solid Queue](references/active-job-and-solid-queue.md) | Commit deferral, continuations, workers, failures, concurrency, recurring tasks |
| [Operations, observability, and deployment](references/operations-observability-and-deployment.md) | Development containers, CI, events, credentials, Kamal upgrades and downgrades |
| [Web, assets, and storage](references/web-assets-and-storage.md) | Controllers, routing, streaming, views, Propshaft, Turbo, uploads, image processing |

## Breaking changes and deprecations

### Configuration and extension cleanup

Delete `config.read_encrypted_secrets`,
`config.action_controller.allow_deprecated_parameters_hash_equality`,
`config.active_record.commit_transaction_on_non_local_return`, and
`config.active_job.use_big_decimal_serializer` from application configuration.
Equality comparison between `ActionController::Parameters` and `Hash` was removed.

Boolean values for `config.action_dispatch.show_exceptions` were removed, as were
`config.action_dispatch.return_only_request_media_type_on_content_type`,
`config.action_mailer.preview_path`, `config.active_storage.replace_on_assign_to_many`,
and `config.active_storage.silence_invalid_content_types_warning`.

Remove the `rails/console/methods` require, invocations of `bin/rake stats`,
references to `STATS_DIRECTORIES`, and the Azure Active Storage service.
Code statistics extensions should use `Rails::CodeStatistics.register_directory`
and `bin/rails stats`.

Supply a deprecator to `deprecate`, `deprecate_constant`, deprecation proxy
constructors, and helpers such as `assert_deprecated`. Pass a single message
string to `ActiveSupport::Deprecation#warn`.

### Routes, views, and query parsing

Replace route declarations mapping one declaration to multiple paths with separate
declarations. Omit `model:` for URL-based `form_with` calls and omit content for
void tags such as `tag.br`; explicit `model: nil` and void-element content were removed.
Action View removed `@rails/ujs` in favor of Turbo.

Leading brackets are preserved in query parameter names, and only `&` separates
query parameters. `config.action_dispatch.ignore_leading_brackets` is deprecated.
`url_for` omits optional route segments with blank-string values, as it does for
`nil`; required segments retain their existing handling.

### Transaction exits and job enqueueing

Leaving a transaction block with `return`, `break`, or `throw` commits it.
For job classes in Rails 8.1, set `self.enqueue_after_transaction_commit = true`
or `false`. The application-wide setting and symbolic values `:always`, `:never`,
and `:default` have been removed.

The default separate Solid Queue database makes queue writes independent of
application transactions. When jobs and app records share a connection, an enqueue
can participate in the app transaction. In Rails 8, setting
`self.enqueue_after_transaction_commit = true` defers enqueueing until commit
regardless of queue connection. Since 8.1.2, `ActiveJob.perform_all_later` also
defers jobs with this setting enabled.

Numeric `scheduled_at` values and `wait: :exponentially_longer` for `retry_on`
were removed. Use the Sucker Punch adapter from the `sucker_punch` gem; the built-in
Sidekiq adapter is deprecated in favor of the `sidekiq` gem's adapter.
Custom serializers must expose `klass` as a public method.

### Database compatibility

Register custom adapters with Active Record and use positional enum declarations
such as `enum :status, { draft: 0, published: 1 }`.
Rails 8.1 requires SQLite 3.23.0 or newer; Rails 8.1.3 raises the PostgreSQL minimum
to 9.5. The minimum supported MySQL version is 5.6.4.

Replace SQLite's removed `retries` option with `timeout`. MySQL's
`unsigned_float` and `unsigned_decimal` helpers were removed; use a check constraint
when a floating-point or decimal column must be nonnegative.

`read_attribute(:id)` reads the attribute named `id` even with a different primary
key. Use `record.id` to read the primary key. Remove `class_name:` from polymorphic
`belongs_to` declarations.

Persist pending association records before a bulk insert or upsert: those operations
discard them and issue a deprecation warning. Using `with`, `with_recursive`, or
`distinct` with `update_all` is deprecated; those clauses are still omitted from SQL.

### Storage and image compatibility

Rails 8.1.3.1 blocks libvips loaders and savers marked untrusted; variants of BMP,
ICO, and PSD attachments can raise `Vips::Error`. Remove affected MIME types from
`config.active_storage.variable_content_types` to skip their variant generation.
If ruby-vips is installed, boot requires libvips 8.13+ and ruby-vips 2.2.1+.

Rails 7.2.3.2 and 8.0.5.1 also apply the restrictions process-wide at boot whenever
`ruby-vips` is installed, even when `:mini_magick` handles variants.
With `image_processing` 2.x, install `ruby-vips` for Vips or `mini_magick` for MiniMagick.
Rails 8.1.4 warns at boot if the configured backend gem is missing.

## Database work

### Setup, pools, and schema dumps

`bin/rails db:migrate` loads the schema before migrations on a fresh database.
`bin/rails db:migrate:reset` drops and recreates the database before replaying
migrations and supports multiple databases.
`bin/rails db:prepare` uses each database's `seeds` flag: it defaults to `true`
for the primary database and `false` for others.

In `config/database.yml`, use `max_connections` for pool size, `min_connections`
for the floor, `keepalive` for idle connection checks, and `max_age` for connection
lifetime. `keepalive: false` disables keepalive checks. Checkout respects
`checkout_timeout` while waiting behind background connection maintenance.

A database entry can set `schema_format: sql` or `schema_format: ruby`.
Rails 8.1.4 restores the adapter's column order in `schema.rb`; serialized schema
caches also preserve column and index order.

### Queries and models

With Rails 8.1 defaults, `first` and `last` raise `ActiveRecord::MissingRequiredOrderError`
when there is no explicit order and no fallback from `implicit_order_column`,
`query_constraints`, or the primary key. Supply an explicit order, or enable this
behavior ahead of a defaults upgrade with
`config.active_record.raise_on_missing_required_finder_order_columns = true`.

Use `in_order_of(:status, [:urgent, :open], filter: false)` to keep unlisted rows
while sorting listed statuses first. `in_order_of` ignores unserializable values;
if all supplied values are unrepresentable, the relation returns no rows.
Pass `cursor:` to batch on custom columns, for example
`Product.in_batches(cursor: [:shop_id, :id]) { |batch| puts batch.count }`.

Set `self.only_columns = %w[id name]` to consider only the listed columns. Deploy
the allowlist before dropping a column so the existing application can run against
either schema. The generated `SELECT` enumerates allowed columns.

### Transactions and signed IDs

`transaction` yields an `ActiveRecord::Transaction` for `after_commit` and
`after_rollback` callbacks; a model's `current_transaction` exposes the same API.
Use `ActiveRecord.after_all_transactions_commit` for code that can run with or
without a surrounding transaction.

Set `config.active_record.use_legacy_signed_id_verifier = :verify` to generate IDs
using `Rails.application.message_verifiers["active_record/signed_id"]` while still
verifying legacy IDs. Replace deprecated `signed_id_verifier_secret` with
`Model.signed_id_verifier` for model-specific verifiers.

## Jobs and queues

Include `ActiveJob::Continuable` and divide long-running work into named steps so
completed steps are skipped after a restart. A step can call a method by name or
take a block. `advance! from:` updates the cursor saved on interruption and
available as `step.cursor` on resumption.

A Solid Queue worker polls its `queues:` list in order; numeric priority applies
within each queue. A standalone `"*"` anywhere in the list polls all queues.
Size the queue database pool at least two connections above the worker's `threads`
count for polling and heartbeats.

`on_conflict: :discard` drops jobs meeting a full concurrency limit; the default
`:block` queues them until a slot opens. Jobs running past `duration` can overlap
with later jobs. Recurring enqueue deduplication requires redundant schedulers to
use the same schedule, with `config.solid_queue.preserve_finished_jobs` enabled
and the job retained; tasks using another Active Job adapter can enqueue duplicates.

## Web responses, assets, and refreshes

New applications set `allow_browser versions: :modern` in `ApplicationController`.
Custom guards accept per-browser minimum versions or `false` to block a browser.
Unknown browsers and requests without a User-Agent header are allowed; blocked
requests receive `public/406-unsupported-browser.html` with HTTP 406.

Use `format.md` in `respond_to` for Markdown requests. `render markdown:` can
take an object whose `to_markdown` method returns the response body.

Use `RAILS_ASSET_URL` in JavaScript processed by Propshaft for digested asset URLs.
Set `config.assets.integrity_hash_algorithm = "sha384"` and pass `integrity: true`
to `stylesheet_link_tag` or `javascript_include_tag` for subresource integrity.
Propshaft also accepts `sha256` and `sha512`; it omits generated hashes on production
HTTP responses.

During a morphing page refresh, Turbo reloads a frame marked `refresh="morph"`
from its `src` and morphs its contents. A Turbo Stream with `action="refresh"`
refreshes the current page; `method` accepts `morph` or `replace`, and `scroll`
accepts `preserve` or `reset`. `broadcasts_refreshes` and `turbo_stream_from`
connect model changes to refresh broadcasts; consecutive broadcasts are debounced.

## Operations and deployment

Run `rails new myapp --devcontainer` for a new app or `rails devcontainer` for an
existing app. Define command steps in `config/ci.rb` and run them with `bin/ci`.
Use `Rails.event.notify` for structured named events; `tagged` adds tags for a block,
and `set_context` adds fields under `event[:context]` on subsequent events.

For an in-place Kamal upgrade, deploy successfully with Kamal 1.9.x first. After
installing Kamal 2, convert configuration, move secrets from `.env` to `.kamal/secrets`,
and validate each destination with `kamal config -d <destination>`.
Kamal 2 changes the proxy's default application port from 3000 to 80; set `app_port`
for a non-default port, or move the application to port 80 and use `EXPOSE 80`.

Run `kamal upgrade` separately for each destination; it replaces Traefik with
`kamal-proxy` and restarts the deployed application and accessories on the `kamal`
Docker network. `kamal upgrade --rolling -d staging` migrates one host at a time.
Starting in Rails 8.1.1, Kamal production configuration leaves SSL assumption and
enforcement off by default. When HTTPS terminates in front of Rails, configure
`config.assume_ssl` and `config.force_ssl` explicitly.

Files in this skill

  • SKILL.md9.5 KB
  • coverage.json1 KB
  • references/active-job-and-solid-queue.md6 KB
  • references/active-record-and-databases.md11.7 KB
  • references/operations-observability-and-deployment.md4.3 KB
  • references/upgrading-and-compatibility.md3.2 KB
  • references/web-assets-and-storage.md5.9 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.