gems activerecord 7.2.2

10 hours ago

Active Support

  • Include options when instrumenting ActiveSupport::Cache::Store#delete and ActiveSupport::Cache::Store#delete_multi.

    Adam Renberg Tamm

  • Print test names when running rails test -v for parallel tests.

    John Hawthorn, Abeid Ahmed

Active Model

  • Fix regression in alias_attribute to work with user defined methods.

    alias_attribute would wrongly assume the attribute accessor was generated by Active Model.

    class Person
      include ActiveModel::AttributeMethods
    
      define_attribute_methods :name
      attr_accessor :name
    
      alias_attribute :full_name, :name
    end
    
    person.full_name # => NoMethodError: undefined method `attribute' for an instance of Person

    Jean Boussier

Active Record

  • Fix support for query_cache: false in database.yml.

    query_cache: false would no longer entirely disable the Active Record query cache.

    zzak

  • Set .attributes_for_inspect to :all by default.

    For new applications it is set to [:id] in config/environment/production.rb.

    In the console all the attributes are always shown.

    Andrew Novoselac

  • PG::UnableToSend: no connection to the server is now retryable as a connection-related exception

    Kazuma Watanabe

  • Fix marshalling of unsaved associated records in 7.1 format.

    The 7.1 format would only marshal associated records if the association was loaded.
    But associations that would only contain unsaved records would be skipped.

    Jean Boussier

  • Fix incorrect SQL query when passing an empty hash to ActiveRecord::Base.insert.

    David Stosik

  • Allow to save records with polymorphic join tables that have inverse_of
    specified.

    Markus Doits

  • Fix association scopes applying on the incorrect join when using a polymorphic has_many through:.

    Joshua Young

  • Fix dependent: :destroy for bi-directional has one through association.

    Fixes #50948.

    class Left < ActiveRecord::Base
      has_one :middle, dependent: :destroy
      has_one :right, through: :middle
    end
    
    class Middle < ActiveRecord::Base
      belongs_to :left, dependent: :destroy
      belongs_to :right, dependent: :destroy
    end
    
    class Right < ActiveRecord::Base
      has_one :middle, dependent: :destroy
      has_one :left, through: :middle
    end

    In the above example left.destroy wouldn't destroy its associated Right
    record.

    Andy Stewart

  • Properly handle lazily pinned connection pools.

    Fixes #53147.

    When using transactional fixtures with system tests to similar tools
    such as capybara, it could happen that a connection end up pinned by the
    server thread rather than the test thread, causing
    "Cannot expire connection, it is owned by a different thread" errors.

    Jean Boussier

  • Fix ActiveRecord::Base.with to accept more than two sub queries.

    Fixes #53110.

    User.with(foo: [User.select(:id), User.select(:id), User.select(:id)]).to_sql
    undefined method `union' for an instance of Arel::Nodes::UnionAll (NoMethodError)

    The above now works as expected.

    fatkodima

  • Properly release pinned connections with non joinable connections.

    Fixes #52973

    When running system tests with transactional fixtures on, it could happen that
    the connection leased by the Puma thread wouldn't be properly released back to the pool,
    causing "Cannot expire connection, it is owned by a different thread" errors in later tests.

    Jean Boussier

  • Make Float distinguish between float4 and float8 in PostgreSQL.

    Fixes #52742

    Ryota Kitazawa, Takayuki Nagatomi

  • Fix an issue where .left_outer_joins used with multiple associations that have
    the same child association but different parents does not join all parents.

    Previously, using .left_outer_joins with the same child association would only join one of the parents.

    Now it will correctly join both parents.

    Fixes #41498.

    Garrett Blehm

  • Ensure ActiveRecord::Encryption.config is always ready before access.

    Previously, ActiveRecord::Encryption configuration was deferred until ActiveRecord::Base
    was loaded. Therefore, accessing ActiveRecord::Encryption.config properties before
    ActiveRecord::Base was loaded would give incorrect results.

    ActiveRecord::Encryption now has its own loading hook so that its configuration is set as
    soon as needed.

    When ActiveRecord::Base is loaded, even lazily, it in turn triggers the loading of
    ActiveRecord::Encryption, thus preserving the original behavior of having its config ready
    before any use of ActiveRecord::Base.

    Maxime Réty

  • Add TimeZoneConverter#== method, so objects will be properly compared by
    their type, scale, limit & precision.

    Address #52699.

    Ruy Rocha

Action View

  • No changes.

Action Pack

  • Fix non-GET requests not updating cookies in ActionController::TestCase.

    Jon Moss, Hartley McGuire

Active Job

  • No changes.

Action Mailer

  • No changes.

Action Cable

  • No changes.

Active Storage

  • No changes.

Action Mailbox

  • No changes.

Action Text

  • No changes.

Railties

  • No changes.

Guides

  • No changes.

Don't miss a new activerecord release

NewReleases is sending notifications on new releases.