Skip to content
Back to skills

Rails Knowledge Patch

ASecurity

Ruby on Rails

  • 25 stars
  • 0 votes
  • 0 copies
  • 5 views
  • Added May 27, 2026
developmentjavascriptrustgojavarubysqlrailsazureapidatabase

Works with

  • cursor
  • cli
  • api

Security analysis

A100/100

Pro scans all 8 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/badge)](https://www.skillsdirectory.com/skills/nevaberry-rails-knowledge-patch)

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
---


# Ruby on Rails Knowledge Patch

Load this skill when upgrading Rails applications or working with database
behavior, background jobs, web responses, assets, storage, or Kamal deployments.
Use the topic references for complete API details, conditions, and examples.

## Reference index

| Reference | Topics |
| --- | --- |
| [Upgrading and compatibility](references/upgrading-and-compatibility.md) | Removed settings, console extensions, routing and view compatibility, deprecators, caching, time, formatting, JSON |
| [Active Record and databases](references/active-record-and-databases.md) | Connections, transactions, migrations, schemas, adapters, model attributes, queries, bulk writes, database tests |
| [Active Job and Solid Queue](references/active-job-and-solid-queue.md) | Commit deferral, serializers, continuations, worker configuration, concurrency, failures, recurring tasks |
| [Operations, observability, and deployment](references/operations-observability-and-deployment.md) | Development containers, system tests, local CI, structured events, credentials, Kamal upgrades and downgrades |
| [Web, assets, and storage](references/web-assets-and-storage.md) | Browser guards, request parsing, routes, forms, Markdown, Propshaft, Turbo, streaming, Action Cable, Active Storage |

## Breaking changes and deprecations

### Configuration and removed interfaces

- Rails 8.0 removes `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`.
- Boolean values for `config.action_dispatch.show_exceptions` and the setting
  `config.action_dispatch.return_only_request_media_type_on_content_type` are removed.
- Equality comparison between `ActionController::Parameters` and `Hash` is removed.
- `config.action_mailer.preview_path` and mailer parameters supplied through
  `args:` in `assert_enqueued_email_with` are removed.
- Rails 8.1 removes the `rails/console/methods` require, `bin/rake stats`,
  `STATS_DIRECTORIES`, and the Azure Active Storage service.
  Use `Rails::CodeStatistics.register_directory` and `bin/rails stats` for code statistics.

### Routes, forms, and support extensions

Use separate declarations for routes that map to multiple paths.
For URL-based `form_with` calls, omit `model:`; explicit `model: nil` is removed.
Omit content for void tags such as `tag.br`.
Action View removed `@rails/ujs` in favor of Turbo.

Supply a deprecator to `deprecate`, `deprecate_constant`, deprecation proxy
constructors, and test helpers such as `assert_deprecated`.
Pass a single message string to `ActiveSupport::Deprecation#warn`.
Rails removed `ActiveSupport::ProxyObject` and the `@` prefix in `attr_internal_naming_format`.

### Database compatibility

Register custom adapters with Active Record and use positional enum declarations,
such as `enum :status, { draft: 0, published: 1 }`.
`ConnectionPool#connection`, database-name arguments to `cache_dump_filename`, and
`ENV["SCHEMA_CACHE"]` are removed.

Rails 8.1 requires SQLite 3.23.0 or newer; Rails 8.1.3 raises the PostgreSQL minimum to 9.5.
Use SQLite's `timeout` configuration instead of `retries`, which is removed in 8.1.
MySQL's `unsigned_float` and `unsigned_decimal` helpers are removed in 8.1;
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 custom primary key.
Use `record.id` to read the primary key.
Leaving a transaction block with `return`, `break`, or `throw` commits it.

### Job compatibility and commit deferral

In Rails 8.1, set `self.enqueue_after_transaction_commit = true` or `false` on
the job class. The application-wide setting and symbolic values `:always`,
`:never`, and `:default` are removed.
Since 8.1.2, `ActiveJob.perform_all_later` also defers jobs with this setting
enabled until the transaction commits.
Deferred `retry_job` enqueueing keeps `wait_until`, `queue`, and `priority`.

Active Job removed numeric `scheduled_at`, `wait: :exponentially_longer` for
`retry_on`, and the primitive `BigDecimal` serializer.
Use the Sucker Punch adapter from `sucker_punch`; the built-in Sidekiq adapter
is deprecated in favor of the adapter from `sidekiq`.
Custom serializers must expose `klass` as a public method.

### Storage and image compatibility

Active Storage filters client-supplied metadata for direct uploads;
set application-controlled metadata on the server.
Rails 8.1.2.1 accepts a single byte range per request and defaults to a 100 MB range limit.
Applications can configure the maximum size of a blob's streamed byte range.

Rails 8.1.3.1 blocks libvips loaders and savers marked untrusted, so 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.
See the storage reference for image-analysis omissions and blocked output formats.

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 quick reference

### Setup, schemas, and pools

`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.
`bin/rails db:prepare` uses each database's `seeds` flag: it defaults to `true`
for the primary database and `false` for others.
Set `seeds: true` for a secondary database if creating it should trigger seed loading.

Since 8.0.3, database entries can set `schema_format: sql` or `schema_format: ruby`.
Rails 8.1.4 restores adapter column order in `schema.rb`; serialized schema
caches also preserve column and index order.

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

### Queries, attributes, and writes

| Need | API or behavior |
| --- | --- |
| Select joined columns | `Post.joins(:comments).pluck(:id, comments: :id)`; hash values accept symbols and strings |
| Order listed values and retain other rows | `in_order_of(:status, [:urgent, :open], filter: false)` |
| Batch on custom columns | `Product.in_batches(cursor: [:shop_id, :id]) { \|batch\| puts batch.count }` |
| Touch timestamps on a direct write | `post.update_column(:published, true, touch: true)` |
| Recalculate multiple counters | `Aircraft.reset_counters([1, 2, 3], :wheels_count)` |
| Temporarily override model settings | `Post.with(strict_loading_by_default: true) { Post.first }`; attributes are restored on exit |

With 8.1 defaults, `first` and `last` raise `ActiveRecord::MissingRequiredOrderError`
without an explicit order or a fallback from `implicit_order_column`,
`query_constraints`, or the primary key. Supply an explicit order.

`insert_all` and `upsert_all` reset the receiver relation and substitute the
adapter's default insert value for `nil` primary keys. Persist pending association
records first: these operations discard them and issue a deprecation warning.
`update_all` and `delete_all` honor `group` and `having` clauses.

Set `self.only_columns = %w[id name]` to consider only the listed columns.
Deploying the allowlist before dropping a column permits either schema;
the generated `SELECT` enumerates allowed columns.

### Transaction callbacks

`transaction` yields an `ActiveRecord::Transaction` for `after_commit` and
`after_rollback`; 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.

## Jobs and queue operations

Include `ActiveJob::Continuable` and split a long-running job into named steps.
Completed steps are skipped after restart. A step can call a method or take a block;
`advance! from:` updates the cursor saved on interruption and read as `step.cursor` on resumption.

The default separate Solid Queue database makes queue writes independent of
application transactions. Shared connections let an enqueue participate in the app transaction.
Set `self.enqueue_after_transaction_commit = true` to defer until commit regardless of connection.

A worker polls its `queues:` list in order; numeric priority applies within each queue.
Size the queue database pool at least two connections above worker `threads` for polling and heartbeats.
`bin/jobs --mode async` runs supervised roles as threads and ignores worker `processes`.
Puma's `plugin :solid_queue` requires app preloading, ruling out phased restarts.

`on_conflict: :discard` drops jobs encountering a full concurrency limit;
the default `:block` queues them. Jobs running past `duration` can overlap later jobs.
Redundant recurring schedulers must share a schedule. Deduplication requires
`config.solid_queue.preserve_finished_jobs` and retention of the job;
tasks using another Active Job adapter can enqueue duplicates.

## Web responses, assets, and refreshes

New apps set `allow_browser versions: :modern` in `ApplicationController`.
Unknown browsers and requests without a User-Agent pass; blocked requests receive
`public/406-unsupported-browser.html` with HTTP 406.
Only `&` separates query parameters; leading brackets are preserved in parameter names.

Use `format.md` in `respond_to` for Markdown requests; `render markdown:` accepts
an object whose `to_markdown` returns the response body.
Use `RAILS_ASSET_URL` inside Propshaft-processed JavaScript for digested asset URLs.
For integrity hashes, set `config.assets.integrity_hash_algorithm = "sha384"`
and pass `integrity: true` to `stylesheet_link_tag` or `javascript_include_tag`.
Propshaft also accepts `sha256` and `sha512`, and omits generated hashes on production HTTP responses.

During a morphing page refresh, a frame with `refresh="morph"` reloads from
its `src` and morphs its contents. A Turbo Stream with `action="refresh"`
can set `method` to `morph` or `replace`, and `scroll` to `preserve` or `reset`.
Use `broadcasts_refreshes` and `turbo_stream_from` for debounced refresh broadcasts;
an associated record's `touch: true` can trigger the parent's refresh broadcast.

## Development, observability, and deployment

Use `rails new myapp --devcontainer` for a new app or `rails devcontainer` for an existing app.
Define local CI steps in `config/ci.rb` and run `bin/ci`.
Start the server with `BACKTRACE=1 bin/rails server` to disable backtrace cleaning.

Publish structured events with `Rails.event.notify`; `tagged` adds block-scoped tags,
and `set_context` adds fields under `event[:context]` on subsequent events.
Active Record emits `active_record.strict_loading_violation` and `active_record.sql`;
event delivery was fixed in 8.1.2. The separate `sql.active_record` notification
includes `affected_rows` and `allow_retry`.

Deploy successfully with Kamal 1.9.x before upgrading in place to 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` if the container keeps a non-default port.
Run `kamal upgrade` separately for each destination; `--rolling` migrates one host at a time.
Starting in 8.1.1, Kamal production configuration leaves SSL assumption and enforcement off.
When HTTPS terminates in front of Rails, configure `config.assume_ssl` and `config.force_ssl` explicitly.

Files in this skill

  • SKILL.md8.5 KB
  • references/active-job-continuations.md797 B
  • references/active-record-columns.md1.2 KB
  • references/active-record-queries.md2.2 KB
  • references/database-config.md1.1 KB
  • references/deprecations.md425 B
  • references/rails-8-architecture.md3.5 KB
  • references/tooling.md1.6 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.