diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-09-22 14:23:40 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-09-22 14:23:40 -0300 |
commit | b61a2db8d07146518c89bbf49176b093771af6d4 (patch) | |
tree | 76f386682896d1c822dc86c5cac87eded37830e3 /activerecord | |
parent | 585e75696b31395aee895e5366e331c07c3f5ee1 (diff) | |
parent | c36ca0547f41373fa3cd474722bc51e5446a1630 (diff) | |
download | rails-b61a2db8d07146518c89bbf49176b093771af6d4.tar.gz rails-b61a2db8d07146518c89bbf49176b093771af6d4.tar.bz2 rails-b61a2db8d07146518c89bbf49176b093771af6d4.zip |
Merge pull request #17009 from arthurnn/foreign_key_symbols
Fixtures using Foreign key symbols
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/fixtures.rb | 2 | ||||
-rw-r--r-- | activerecord/test/cases/fixtures_test.rb | 2 | ||||
-rw-r--r-- | activerecord/test/models/parrot.rb | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/fixtures.rb b/activerecord/lib/active_record/fixtures.rb index 1724fa893d..4044f5f7b2 100644 --- a/activerecord/lib/active_record/fixtures.rb +++ b/activerecord/lib/active_record/fixtures.rb @@ -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 diff --git a/activerecord/test/cases/fixtures_test.rb b/activerecord/test/cases/fixtures_test.rb index 385ec48005..1050047a43 100644 --- a/activerecord/test/cases/fixtures_test.rb +++ b/activerecord/test/cases/fixtures_test.rb @@ -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 diff --git a/activerecord/test/models/parrot.rb b/activerecord/test/models/parrot.rb index e76e83f314..8c83de573f 100644 --- a/activerecord/test/models/parrot.rb +++ b/activerecord/test/models/parrot.rb @@ -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 |