Fix generated ref commit association in Rails 7.2

What does this MR do and why?

This fixes a deprecation in the association definition:

DEPRECATION WARNING: Setting `query_constraints:` option on
`MergeRequests::GeneratedRefCommit.belongs_to :merge_request` is
deprecated. To maintain current behavior, use the `foreign_key` option
instead.

We need to change this as this was causing a spec failure in ee/spec/models/merge_trains/car_spec.rb when we save the associated generated ref commit records.

References

How to set up and validate locally

  1. Switch to hly-rails-7-2 branch which contains this patch. (The spec would still fail with this patch on master because other fixes still need to be merged)

  2. Run test in Rails 7.2:

    BUNDLE_GEMFILE=Gemfile.next bundle exec rspec ee/spec/models/merge_trains/car_spec.rb
  3. Run test in Rails 7.1:

    bundle exec rspec ee/spec/models/merge_trains/car_spec.rb

Both runs should pass

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Heinrich Lee Yu

Merge request reports

Loading