diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-06-13 18:19:18 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-06-13 18:19:18 -0300 |
commit | 4c0a1021e51bfb8f3623480f577f7f52d83a0fc7 (patch) | |
tree | 2aaff660948a48ff70a4351446f9f1a1a8908ea5 /activerecord/test/models | |
parent | c28e436aae4a13225d86e00094a5fa72d82fc297 (diff) | |
parent | 9feadc11a71b655dd7748c0f3a92bc411c9e63c2 (diff) | |
download | rails-4c0a1021e51bfb8f3623480f577f7f52d83a0fc7.tar.gz rails-4c0a1021e51bfb8f3623480f577f7f52d83a0fc7.tar.bz2 rails-4c0a1021e51bfb8f3623480f577f7f52d83a0fc7.zip |
Merge pull request #15343 from dontfidget/fix_polymorphic_automatic_inverse_of
prevent bad automatic inverse_of association
Diffstat (limited to 'activerecord/test/models')
-rw-r--r-- | activerecord/test/models/face.rb | 1 | ||||
-rw-r--r-- | activerecord/test/models/man.rb | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/activerecord/test/models/face.rb b/activerecord/test/models/face.rb index edb75d333f..3d7f0626e2 100644 --- a/activerecord/test/models/face.rb +++ b/activerecord/test/models/face.rb @@ -1,6 +1,7 @@ class Face < ActiveRecord::Base belongs_to :man, :inverse_of => :face belongs_to :polymorphic_man, :polymorphic => true, :inverse_of => :polymorphic_face + belongs_to :polymorphic_man_without_inverse, :polymorphic => true # These is a "broken" inverse_of for the purposes of testing belongs_to :horrible_man, :class_name => 'Man', :inverse_of => :horrible_face belongs_to :horrible_polymorphic_man, :polymorphic => true, :inverse_of => :horrible_polymorphic_face diff --git a/activerecord/test/models/man.rb b/activerecord/test/models/man.rb index f4d127730c..a26491ce61 100644 --- a/activerecord/test/models/man.rb +++ b/activerecord/test/models/man.rb @@ -1,6 +1,7 @@ class Man < ActiveRecord::Base has_one :face, :inverse_of => :man has_one :polymorphic_face, :class_name => 'Face', :as => :polymorphic_man, :inverse_of => :polymorphic_man + has_one :polymorphic_face_without_inverse, :class_name => 'Face', :as => :polymorphic_man_without_inverse has_many :interests, :inverse_of => :man has_many :polymorphic_interests, :class_name => 'Interest', :as => :polymorphic_man, :inverse_of => :polymorphic_man # These are "broken" inverse_of associations for the purposes of testing |