Merge pull request #50773 from skipkayhil/hm-fix-another-compat-issue

Fix t.references validating options on Rails < 7.1
This commit is contained in:
Rafael Mendonça França 2024-01-16 18:09:33 -05:00 committed by GitHub
commit 474ee0a014
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 1 deletions

View File

@ -1,5 +1,5 @@
* Fix Migrations with versions older than 7.1 validating options given to * Fix Migrations with versions older than 7.1 validating options given to
`add_reference`. `add_reference` and `t.references`.
*Hartley McGuire* *Hartley McGuire*

View File

@ -82,6 +82,11 @@ module ActiveRecord
super super
end end
def references(*args, **options)
options[:_skip_validate_options] = true
super
end
private private
def raise_on_if_exist_options(options) def raise_on_if_exist_options(options)
end end

View File

@ -673,6 +673,7 @@ module NoOptionValidationTestCases
change_table :tests do |t| change_table :tests do |t|
t.change :some_id, :float, null: false, wrong_index: true t.change :some_id, :float, null: false, wrong_index: true
t.integer :another_id, wrong_unique: true t.integer :another_id, wrong_unique: true
t.references :yet_another_table, bad: :option
end end
end end
}.new }.new