mirror of https://github.com/rails/rails
Fix t.references validating options on Rails < 7.1
Option validation was [added][1] for 7.1+ Migration classes, and a compatibility layer was added to ensure that previous Migration versions do not have their options validated. However, the `t.references` method was missing in the compatibility layer which results in pre 7.1 Migrations validating options passed to `t.references`. This commit fixes the issue by adding t.references to the compatibility layer. See also a [similar fix][2] for `add_reference` [1]:e6da3ebd6c
[2]:71b4e22301
This commit is contained in:
parent
299900f4e5
commit
327f28b65f
|
@ -1,5 +1,5 @@
|
|||
* Fix Migrations with versions older than 7.1 validating options given to
|
||||
`add_reference`.
|
||||
`add_reference` and `t.references`.
|
||||
|
||||
*Hartley McGuire*
|
||||
|
||||
|
|
|
@ -82,6 +82,11 @@ module ActiveRecord
|
|||
super
|
||||
end
|
||||
|
||||
def references(*args, **options)
|
||||
options[:_skip_validate_options] = true
|
||||
super
|
||||
end
|
||||
|
||||
private
|
||||
def raise_on_if_exist_options(options)
|
||||
end
|
||||
|
|
|
@ -673,6 +673,7 @@ module NoOptionValidationTestCases
|
|||
change_table :tests do |t|
|
||||
t.change :some_id, :float, null: false, wrong_index: true
|
||||
t.integer :another_id, wrong_unique: true
|
||||
t.references :yet_another_table, bad: :option
|
||||
end
|
||||
end
|
||||
}.new
|
||||
|
|
Loading…
Reference in New Issue