> For the complete documentation index, see [llms.txt](https://ploegert.gitbook.io/til/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ploegert.gitbook.io/til/programmy/rails.md).

# rails

- [Add A Check Constraint To A Table](https://ploegert.gitbook.io/til/programmy/rails/add-a-check-constraint-to-a-table.md)
- [Add A Foreign Key Reference To A Table](https://ploegert.gitbook.io/til/programmy/rails/add-a-foreign-key-reference-to-a-table.md)
- [Add A Reference Column With An Index](https://ploegert.gitbook.io/til/programmy/rails/add-a-reference-column-with-an-index.md)
- [Add ActiveRecord Error Not Tied To Any Attribute](https://ploegert.gitbook.io/til/programmy/rails/add-activerecord-error-not-tied-to-any-attribute.md)
- [Add React With Webpacker To A New Rails App](https://ploegert.gitbook.io/til/programmy/rails/add-react-with-webpacker-to-a-new-rails-app.md)
- [Add timestamptz Columns With The Migration DSL](https://ploegert.gitbook.io/til/programmy/rails/add-timestamptz-columns-with-the-migration-dsl.md)
- [Access Secrets In A Rails 5.2 App](https://ploegert.gitbook.io/til/programmy/rails/access-secrets-in-a-rails-5-2-app.md)
- [ActiveRecord Query For This Or That](https://ploegert.gitbook.io/til/programmy/rails/active-record-query-for-this-or-that.md)
- [Advance The Date](https://ploegert.gitbook.io/til/programmy/rails/advance-the-date.md)
- [Allow List Params Anywhere With Strong Params](https://ploegert.gitbook.io/til/programmy/rails/allow-list-params-anywhere-with-strong-params.md)
- [All or Nothing Database Transactions](https://ploegert.gitbook.io/til/programmy/rails/all-or-nothing-database-transactions.md)
- [Assert Two Arrays Have The Same Items With RSpec](https://ploegert.gitbook.io/til/programmy/rails/assert-two-arrays-have-the-same-items-with-rspec.md)
- [Attach A File With Capybara](https://ploegert.gitbook.io/til/programmy/rails/attach-a-file-with-capybara.md)
- [Attribute Getter without the Recursion](https://ploegert.gitbook.io/til/programmy/rails/attribute-getter-without-the-recursion.md)
- [Attribute Was](https://ploegert.gitbook.io/til/programmy/rails/attribute-was.md)
- [Autosave False On ActiveRecord Associations](https://ploegert.gitbook.io/til/programmy/rails/autosave-false-on-activerecord-associations.md)
- [Bind Parameters To ActiveRecord SQL Query](https://ploegert.gitbook.io/til/programmy/rails/bind-parameters-to-activerecord-sql-query.md)
- [Build A Hash Of Model Attributes](https://ploegert.gitbook.io/til/programmy/rails/build-a-hash-of-model-attributes.md)
- [Capture Development Emails With Mailhog](https://ploegert.gitbook.io/til/programmy/rails/capture-development-emails-with-mailhog.md)
- [Capybara Page Status Code](https://ploegert.gitbook.io/til/programmy/rails/capybara-page-status-code.md)
- [Cast Common Boolean-Like Values To Booleans](https://ploegert.gitbook.io/til/programmy/rails/cast-common-boolean-like-values-to-booleans.md)
- [Change The Nullability Of A Column](https://ploegert.gitbook.io/til/programmy/rails/change-the-nullability-of-a-column.md)
- [Change The Time Zone Offset Of A DateTime Object](https://ploegert.gitbook.io/til/programmy/rails/change-the-time-zone-offset-of-a-datetime-object.md)
- [Check If ActiveRecord Update Fails](https://ploegert.gitbook.io/til/programmy/rails/check-if-activerecord-update-fails.md)
- [Check If Any Records Have A Null Value](https://ploegert.gitbook.io/til/programmy/rails/check-if-any-records-have-a-null-value.md)
- [Check Specific Attributes On ActiveRecord Array](https://ploegert.gitbook.io/til/programmy/rails/check-specific-attributes-on-activerecord-array.md)
- [Code Statistics For An Application](https://ploegert.gitbook.io/til/programmy/rails/code-statistics-for-an-application.md)
- [Columns With Default Values Are Nil On Create](https://ploegert.gitbook.io/til/programmy/rails/columns-with-default-values-are-nil-on-create.md)
- [Comparing DateTimes Down To Second Precision](https://ploegert.gitbook.io/til/programmy/rails/comparing-datetimes-down-to-second-precision.md)
- [Conditional Class Selectors in Haml](https://ploegert.gitbook.io/til/programmy/rails/conditional-class-selectors-in-haml.md)
- [Convert A Symbol To A Constant](https://ploegert.gitbook.io/til/programmy/rails/convert-a-symbol-to-a-constant.md)
- [Count The Number Of Records By Attribute](https://ploegert.gitbook.io/til/programmy/rails/count-the-number-of-records-by-attribute.md)
- [Create A Custom Named References Column](https://ploegert.gitbook.io/til/programmy/rails/create-a-custom-named-references-column.md)
- [Create A Join Table With The Migration DSL](https://ploegert.gitbook.io/til/programmy/rails/create-a-join-table-with-the-migration-dsl.md)
- [Creating Records of Has\_One Associations](https://ploegert.gitbook.io/til/programmy/rails/creating-records-of-has-one-associations.md)
- [Custom Validation Message](https://ploegert.gitbook.io/til/programmy/rails/custom-validation-message.md)
- [Customize Paths And Helpers For Devise Routes](https://ploegert.gitbook.io/til/programmy/rails/customize-paths-and-helpers-for-devise-routes.md)
- [Customize The Path Of A Resource Route](https://ploegert.gitbook.io/til/programmy/rails/customize-the-path-of-a-resource-route.md)
- [Delete Paranoid Records](https://ploegert.gitbook.io/til/programmy/rails/delete-paranoid-records.md)
- [Demodulize A Class Name](https://ploegert.gitbook.io/til/programmy/rails/demodulize-a-class-name.md)
- [Different Ways To Add A Foreign Key Reference](https://ploegert.gitbook.io/til/programmy/rails/different-ways-to-add-a-foreign-key-reference.md)
- [Disambiguate Where In A Joined Relation](https://ploegert.gitbook.io/til/programmy/rails/disambiguate-where-in-a-joined-relation.md)
- [Ensure Migrations Use The Latest Schema](https://ploegert.gitbook.io/til/programmy/rails/ensure-migrations-use-the-latest-schema.md)
- [Find Or Create A Record With FactoryBot](https://ploegert.gitbook.io/til/programmy/rails/find-or-create-a-record-with-factory-bot.md)
- [Force All Users To Sign Out](https://ploegert.gitbook.io/til/programmy/rails/force-all-users-to-sign-out.md)
- [Generating And Executing SQL](https://ploegert.gitbook.io/til/programmy/rails/generating-and-executing-sql.md)
- [Get An Array Of Values From The Database](https://ploegert.gitbook.io/til/programmy/rails/get-an-array-of-values-from-the-database.md)
- [Get An Empty ActiveRecord Relation](https://ploegert.gitbook.io/til/programmy/rails/get-an-empty-activerecord-relation.md)
- [Get The Column Names For A Model](https://ploegert.gitbook.io/til/programmy/rails/get-the-column-names-for-a-model.md)
- [Get The Current Time](https://ploegert.gitbook.io/til/programmy/rails/get-the-current-time.md)
- [Grab A Random Record From The Database](https://ploegert.gitbook.io/til/programmy/rails/grab-a-random-record-from-the-database.md)
- [Handle Named Arguments In A Rake Task](https://ploegert.gitbook.io/til/programmy/rails/handle-named-arguments-in-a-rake-task.md)
- [Hash Slicing](https://ploegert.gitbook.io/til/programmy/rails/hash-slicing.md)
- [Ignore Poltergeist JavaScript Errors](https://ploegert.gitbook.io/til/programmy/rails/ignore-poltergeist-javascript-errors.md)
- [Include Devise Helpers In Your Controller Tests](https://ploegert.gitbook.io/til/programmy/rails/include-devise-helpers-in-your-controller-tests.md)
- [Inspect Previous Changes To ActiveRecord Object](https://ploegert.gitbook.io/til/programmy/rails/inspect-previous-changes-to-activerecord-object.md)
- [Link To The Current Page With Query Params](https://ploegert.gitbook.io/til/programmy/rails/link-to-the-current-page-with-query-params.md)
- [List All Installable Rails Versions](https://ploegert.gitbook.io/til/programmy/rails/list-all-installable-rails-versions.md)
- [List The Enqueued Jobs](https://ploegert.gitbook.io/til/programmy/rails/list-the-enqueued-jobs.md)
- [Load Records In Batches With find\_each](https://ploegert.gitbook.io/til/programmy/rails/load-records-in-batches-with-find-each.md)
- [Log SQL Queries Executed By ActiveRecord](https://ploegert.gitbook.io/til/programmy/rails/log-sql-queries-executed-by-activerecord.md)
- [Mark A Migration As Irreversible](https://ploegert.gitbook.io/til/programmy/rails/mark-a-migration-as-irreversible.md)
- [Make ActionMailer Synchronous In Test](https://ploegert.gitbook.io/til/programmy/rails/make-action-mailer-synchronous-in-test.md)
- [Manually Run A Migration From Rails Console](https://ploegert.gitbook.io/til/programmy/rails/manually-run-a-migration-from-rails-console.md)
- [Mark For Destruction](https://ploegert.gitbook.io/til/programmy/rails/mark-for-destruction.md)
- [Mask An ActiveRecord Attribute](https://ploegert.gitbook.io/til/programmy/rails/mask-an-activerecord-attribute.md)
- [Merge A Scope Into An ActiveRecord Query](https://ploegert.gitbook.io/til/programmy/rails/merge-a-scope-into-an-activerecord-query.md)
- [Migrating Up Down Up](https://ploegert.gitbook.io/til/programmy/rails/migrating-up-down-up.md)
- [Order Matters For rescue\_from Blocks](https://ploegert.gitbook.io/til/programmy/rails/order-matters-for-rescue-from-blocks.md)
- [Params Includes Submission Button Info](https://ploegert.gitbook.io/til/programmy/rails/params-includes-submission-button-info.md)
- [Parse Query Params From A URL](https://ploegert.gitbook.io/til/programmy/rails/parse-query-params-from-a-url.md)
- [Perform SQL Explain With ActiveRecord](https://ploegert.gitbook.io/til/programmy/rails/perform-sql-explain-with-activerecord.md)
- [Polymorphic Path Helpers](https://ploegert.gitbook.io/til/programmy/rails/polymorphic-path-helpers.md)
- [Pretend Generations](https://ploegert.gitbook.io/til/programmy/rails/pretend-generations.md)
- [Prevent Writes With A Sandboxed Rails Console](https://ploegert.gitbook.io/til/programmy/rails/prevent-writes-with-a-sandboxed-rails-console.md)
- [Query A Single Value From The Database](https://ploegert.gitbook.io/til/programmy/rails/query-a-single-value-from-the-database.md)
- [Read In Environment-Specific Config Values](https://ploegert.gitbook.io/til/programmy/rails/read-in-environment-specific-config-values.md)
- [Read-Only Models](https://ploegert.gitbook.io/til/programmy/rails/read-only-models.md)
- [Remove The Default Value On A Column](https://ploegert.gitbook.io/til/programmy/rails/remove-the-default-value-on-a-column.md)
- [Render An Alternative ActionMailer Template](https://ploegert.gitbook.io/til/programmy/rails/render-an-alternative-action-mailer-template.md)
- [Render The Response Body In Controller Specs](https://ploegert.gitbook.io/til/programmy/rails/render-the-response-body-in-controller-specs.md)
- [Replace An Index With A Unique Index](https://ploegert.gitbook.io/til/programmy/rails/replace-an-index-with-a-unique-index.md)
- [Rescue From](https://ploegert.gitbook.io/til/programmy/rails/rescue-from.md)
- [Rescue From With A Separate Method](https://ploegert.gitbook.io/til/programmy/rails/rescue-from-with-a-separate-method.md)
- [Retrieve An Object If It Exists](https://ploegert.gitbook.io/til/programmy/rails/retrieve-an-object-if-it-exists.md)
- [Rollback A Specific Migration Out Of Order](https://ploegert.gitbook.io/til/programmy/rails/rollback-a-specific-migration-out-of-order.md)
- [Rounding Numbers With Precision](https://ploegert.gitbook.io/til/programmy/rails/rounding-numbers-with-precision.md)
- [Schedule Sidekiq Jobs Out Into The Future](https://ploegert.gitbook.io/til/programmy/rails/schedule-sidekiq-jobs-out-into-the-future.md)
- [Secure Passwords With Rails And Bcrypt](https://ploegert.gitbook.io/til/programmy/rails/secure-passwords-with-rails-and-bcrypt.md)
- [Select A Select By Selector](https://ploegert.gitbook.io/til/programmy/rails/select-a-select-by-selector.md)
- [Select Value For SQL Counts](https://ploegert.gitbook.io/til/programmy/rails/select-value-for-sql-counts.md)
- [Serialize With fast\_jsonapi In A Rails App](https://ploegert.gitbook.io/til/programmy/rails/serialize-with-fast-jsonapi-in-a-rails-app.md)
- [Set A Timestamp Field To The Current Time](https://ploegert.gitbook.io/til/programmy/rails/set-a-timestamp-field-to-the-current-time.md)
- [Set default\_url\_options For Entire Application](https://ploegert.gitbook.io/til/programmy/rails/set-default-url-options-for-entire-application.md)
- [Set Schema Search Path](https://ploegert.gitbook.io/til/programmy/rails/set-schema-search-path.md)
- [Set Statement Timeout For All Postgres Connections](https://ploegert.gitbook.io/til/programmy/rails/set-statement-timeout-for-all-postgres-connections.md)
- [Set The Default Development Port](https://ploegert.gitbook.io/til/programmy/rails/set-the-default-development-port.md)
- [Show Pending Migrations](https://ploegert.gitbook.io/til/programmy/rails/show-pending-migrations.md)
- [Show Rails Models With Pry](https://ploegert.gitbook.io/til/programmy/rails/show-rails-models-with-pry.md)
- [Show Rails Routes With Pry](https://ploegert.gitbook.io/til/programmy/rails/show-rails-routes-with-pry.md)
- [Skip Validations When Creating A Record](https://ploegert.gitbook.io/til/programmy/rails/skip-validations-when-creating-a-record.md)
- [Specify New Attributes For #find\_or\_create\_by](https://ploegert.gitbook.io/til/programmy/rails/specify-new-attributes-for-find-or-create-by.md)
- [Temporarily Disable strong\_params](https://ploegert.gitbook.io/til/programmy/rails/temporarily-disable-strong-params.md)
- [Test If An Instance Variable Was Assigned](https://ploegert.gitbook.io/til/programmy/rails/test-if-an-instance-variable-was-assigned.md)
- [Test If deliver\_later Is Called For A Mailer](https://ploegert.gitbook.io/til/programmy/rails/test-if-deliver-later-is-called-for-a-mailer.md)
- [Truncate Almost All Tables](https://ploegert.gitbook.io/til/programmy/rails/truncate-almost-all-tables.md)
- [Update Column Versus Update Attribute](https://ploegert.gitbook.io/til/programmy/rails/update-column-versus-update-attribute.md)
- [Upgrading Your Manifest For Sprocket's 4](https://ploegert.gitbook.io/til/programmy/rails/upgrading-your-manifest-for-sprockets-4.md)
- [Verify And Read A Signed Cookie Value](https://ploegert.gitbook.io/til/programmy/rails/verify-and-read-a-signed-cookie-value.md)
- [Where Am I In The Partial Iteration?](https://ploegert.gitbook.io/til/programmy/rails/where-am-i-in-the-partial-iteration.md)
- [Wipe Out All Precompiled Assets](https://ploegert.gitbook.io/til/programmy/rails/wipe-out-all-precompiled-assets.md)
- [Write Reversible Migration To Set Default](https://ploegert.gitbook.io/til/programmy/rails/write-reversible-migration-to-set-default.md)
- [Write Safer Where Clauses With Placeholders](https://ploegert.gitbook.io/til/programmy/rails/write-safer-where-clauses-with-placeholders.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ploegert.gitbook.io/til/programmy/rails.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
