Skip to content

rails 8.0.3

Active Support

  • ActiveSupport::FileUpdateChecker does not depend on Time.now to prevent unnecessary reloads with time travel test helpers

    Jan Grodowski

  • Fix ActiveSupport::BroadcastLogger from executing a block argument for each logger (tagged, info, etc.).

    Jared Armstrong

  • Make ActiveSupport::Logger #freeze-friendly.

    Joshua Young

  • Fix ActiveSupport::HashWithIndifferentAccess#transform_keys! removing defaults.

    Hartley McGuire

  • Fix ActiveSupport::HashWithIndifferentAccess#tranform_keys! to handle collisions.

    If the transformation would result in a key equal to another not yet transformed one, it would result in keys being lost.

    Before:

    >> {a: 1, b: 2}.with_indifferent_access.transform_keys!(&:succ)
    => {"c" => 1}
    

    After:

    >> {a: 1, b: 2}.with_indifferent_access.transform_keys!(&:succ)
    => {"c" => 1, "d" => 2}
    

    Jason T Johnson, Jean Boussier

  • Fix ActiveSupport::Cache::MemCacheStore#read_multi to handle network errors.

    This method specifically wasn't handling network errors like other codepaths.

    Alessandro Dal Grande

  • Fix configuring RedisCacheStore with raw: true.

    fatkodima

  • Fix Enumerable#sole for infinite collections.

    fatkodima

Active Model

  • Fix has_secure_password to perform confirmation validation of the password even when blank.

    The validation was incorrectly skipped when the password only contained whitespace characters.

    Fabio Sangiovanni

Active Record

  • Fix query cache for pinned connections in multi threaded transactional tests

    When a pinned connection is used across separate threads, they now use a separate cache store for each thread.

    This improve accuracy of system tests, and any test using multiple threads.

    Heinrich Lee Yu, Jean Boussier

  • Don't add id_value attribute alias when attribute/column with that name already exists.

    Rob Lewis

  • Fix false positive change detection involving STI and polymorphic has one relationships.

    Polymorphic has_one relationships would always be considered changed when defined in a STI child class, causing nedless extra autosaves.

    David Fritsch

  • Skip calling PG::Connection#cancel in cancel_any_running_query when using libpq >= 18 with pg < 1.6.0, due to incompatibility. Rollback still runs, but may take longer.

    Yasuo Honda, Lars Kanis

  • Fix stale association detection for polymorphic belongs_to.

    Florent Beaurain, Thomas Crambert

  • Fix removal of PostgreSQL version comments in structure.sql for latest PostgreSQL versions which include \restrict

    Brendan Weibrecht

  • Allow setting schema_format in database configuration.

    primary:
      schema_format: ruby
    

    Useful in multi-database setups to have different formats per-database.

    T S Vallender

  • Use ntuples to populate row_count instead of count for Postgres

    Jonathan Calvert

  • Fix #merge with #or or #and and a mixture of attributes and SQL strings resulting in an incorrect query.

    base = Comment.joins(:post).where(user_id: 1).where("recent = 1")
    puts base.merge(base.where(draft: true).or(Post.where(archived: true))).to_sql
    

    Before:

  SELECT "comments".* FROM "comments"
  INNER JOIN "posts" ON "posts"."id" = "comments"."post_id"
  WHERE (recent = 1)
  AND (
    "comments"."user_id" = 1
    AND (recent = 1)
    AND "comments"."draft" = 1
    OR "posts"."archived" = 1
  )
  ```

  After:

```sql
  SELECT "comments".* FROM "comments"
  INNER JOIN "posts" ON "posts"."id" = "comments"."post_id"
  WHERE "comments"."user_id" = 1
  AND (recent = 1)
  AND (
    "comments"."user_id" = 1
    AND (recent = 1)
    AND "comments"."draft" = 1
    OR "posts"."archived" = 1
  )
  ```

  *Joshua Young*

*   Fix inline `has_and_belongs_to_many` fixtures for tables with composite primary keys.

  *fatkodima*

*   Fix migration log message for down operations.

  *Bernardo Barreto*

*   Prepend `extra_flags` in postgres' `structure_load`

  When specifying `structure_load_flags` with a postgres adapter, the flags
  were appended to the default flags, instead of prepended.
  This caused issues with flags not being taken into account by postgres.

  *Alice Loeser*

*   Fix `annotate` comments to propagate to `update_all`/`delete_all`.

  *fatkodima*

*   Fix checking whether an unpersisted record is `include?`d in a strictly
  loaded `has_and_belongs_to_many` association.

  *Hartley McGuire*

*   `create_or_find_by` will now correctly rollback a transaction.

  When using `create_or_find_by`, raising a ActiveRecord::Rollback error
  in a `after_save` callback had no effect, the transaction was committed
  and a record created.

  *Edouard Chin*

*   Gracefully handle `Timeout.timeout` firing during connection configuration.

  Use of `Timeout.timeout` could result in improperly initialized database connection.

  This could lead to a partially configured connection being used, resulting in various exceptions,
  the most common being with the PostgreSQLAdapter raising `undefined method 'key?' for nil`
  or `TypeError: wrong argument type nil (expected PG::TypeMap)`.

  *Jean Boussier*

*   Fix stale state for composite foreign keys in belongs_to associations.

  *Varun Sharma*


## Action View

*   Fix label with `for` option not getting prefixed by form `namespace` value

  *Abeid Ahmed*, *Hartley McGuire*

*   Fix `javascript_include_tag` `type` option to accept either strings and symbols.

  ```ruby
  javascript_include_tag "application", type: :module
  javascript_include_tag "application", type: "module"
  ```

  Previously, only the string value was recognized.

  *Jean Boussier*

*   Fix `excerpt` helper with non-whitespace separator.

  *Jonathan Hefner*


## Action Pack

*   URL helpers for engines mounted at the application root handle `SCRIPT_NAME` correctly.

  Fixed an issue where `SCRIPT_NAME` is not applied to paths generated for routes in an engine
  mounted at "/".

  *Mike Dalessio*

*   Fix `Rails.application.reload_routes!` from clearing almost all routes.

  When calling `Rails.application.reload_routes!` inside a middleware of
  a Rake task, it was possible under certain conditions that all routes would be cleared.
  If ran inside a middleware, this would result in getting a 404 on most page you visit.
  This issue was only happening in development.

  *Edouard Chin*

*   Address `rack 3.2` deprecations warnings.

  ```
  warning: Status code :unprocessable_entity is deprecated and will be removed in a future version of Rack.
  Please use :unprocessable_content instead.
  ```

  Rails API will transparently convert one into the other for the foreseeable future.

  *Earlopain*, *Jean Boussier*

*   Support hash-source in Content Security Policy.

  *madogiwa*

*   Always return empty body for HEAD requests in `PublicExceptions` and
  `DebugExceptions`.

  This is required by `Rack::Lint` (per RFC9110).

  *Hartley McGuire*


## Active Job

*   Include the actual Active Job locale when serializing rather than I18n locale.

  *Adrien S*

*   Fix `retry_job` instrumentation when using `:test` adapter for Active Job.

  *fatkodima*


## Action Mailer

*   No changes.


## Action Cable

*   Fixed compatibility with `redis` gem `5.4.1`

  *Jean Boussier*

*   Fixed a possible race condition in `stream_from`.

  *OuYangJinTing*


## Active Storage

*   Address deprecation of `Aws::S3::Object#upload_stream` in `ActiveStorage::Service::S3Service`.

  *Joshua Young*

*   Fix `config.active_storage.touch_attachment_records` to work with eager loading.

  *fatkodima*


## Action Mailbox

*   No changes.


## Action Text

*   Add rollup-plugin-terser as a dev dependency.

  *Édouard Chin*


## Railties

*   Fix `polymorphic_url` and `polymorphic_path` not working when routes are not loaded.

  *Édouard Chin*

*   Fix Rails console to not override user defined IRB_NAME.

  Only change the prompt name if it hasn't been customized in `.irbrc`.

  *Jarrett Lusso*


## Guides

*   No changes.