提交 b61a2db8 编写于 作者: R Rafael Mendonça França

Merge pull request #17009 from arthurnn/foreign_key_symbols

Fixtures using Foreign key symbols
......@@ -661,7 +661,7 @@ def table_rows
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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册