mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #17009 from arthurnn/foreign_key_symbols
Fixtures using Foreign key symbols
This commit is contained in:
commit
b61a2db8d0
3 changed files with 3 additions and 3 deletions
|
@ -661,7 +661,7 @@ module ActiveRecord
|
|||
row[association.foreign_type] = $1
|
||||
end
|
||||
|
||||
fk_type = association.active_record.columns_hash[association.foreign_key].type
|
||||
fk_type = association.active_record.columns_hash[fk_name].type
|
||||
row[fk_name] = ActiveRecord::FixtureSet.identify(value, fk_type)
|
||||
end
|
||||
when :has_many
|
||||
|
|
|
@ -675,7 +675,7 @@ class FoxyFixturesTest < ActiveRecord::TestCase
|
|||
if ActiveRecord::Base.connection.adapter_name == 'PostgreSQL'
|
||||
require 'models/uuid_parent'
|
||||
require 'models/uuid_child'
|
||||
fixtures :uuid_parents, :uuid_children
|
||||
fixtures :uuid_parents, :uuid_children
|
||||
end
|
||||
|
||||
def test_identifies_strings
|
||||
|
|
|
@ -19,7 +19,7 @@ class LiveParrot < Parrot
|
|||
end
|
||||
|
||||
class DeadParrot < Parrot
|
||||
belongs_to :killer, :class_name => 'Pirate'
|
||||
belongs_to :killer, :class_name => 'Pirate', foreign_key: :killer_id
|
||||
end
|
||||
|
||||
class FunkyParrot < Parrot
|
||||
|
|
Loading…
Reference in a new issue