aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models
diff options
context:
space:
mode:
authorAkira Matsuda <ronnie@dio.jp>2014-09-06 20:06:40 +0900
committerAkira Matsuda <ronnie@dio.jp>2014-09-06 23:28:18 +0900
commitda2f61947db287b5ba0343905da9316eecfd43f3 (patch)
tree8697e52bdff9fe718c9529c162cc7dd05cf97011 /activerecord/test/models
parente11914b55110e8376e43476668ed8d5323b8dcba (diff)
downloadrails-da2f61947db287b5ba0343905da9316eecfd43f3.tar.gz
rails-da2f61947db287b5ba0343905da9316eecfd43f3.tar.bz2
rails-da2f61947db287b5ba0343905da9316eecfd43f3.zip
Dynamically modified schema and association would not be correctly reset
This fixes <"SQLite3::SQLException: no such column: legacy_things.person_id: SELECT \"legacy_things\".* FROM \"legacy_things\" WHERE \"legacy_things\".\"person_id\" = ?"> in OptimisticLockingTest#test_lock_destroy
Diffstat (limited to 'activerecord/test/models')
-rw-r--r--activerecord/test/models/person.rb2
-rw-r--r--activerecord/test/models/personal_legacy_thing.rb4
2 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/test/models/person.rb b/activerecord/test/models/person.rb
index c7e54e7b63..ad12f00d42 100644
--- a/activerecord/test/models/person.rb
+++ b/activerecord/test/models/person.rb
@@ -30,6 +30,8 @@ class Person < ActiveRecord::Base
has_many :agents_of_agents, :through => :agents, :source => :agents
belongs_to :number1_fan, :class_name => 'Person'
+ has_many :personal_legacy_things, :dependent => :destroy
+
has_many :agents_posts, :through => :agents, :source => :posts
has_many :agents_posts_authors, :through => :agents_posts, :source => :author
has_many :essays, primary_key: "first_name", foreign_key: "writer_id"
diff --git a/activerecord/test/models/personal_legacy_thing.rb b/activerecord/test/models/personal_legacy_thing.rb
new file mode 100644
index 0000000000..a7ee3a0bca
--- /dev/null
+++ b/activerecord/test/models/personal_legacy_thing.rb
@@ -0,0 +1,4 @@
+class PersonalLegacyThing < ActiveRecord::Base
+ self.locking_column = :version
+ belongs_to :person, :counter_cache => true
+end