aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models/developer.rb
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2012-12-04 04:49:07 -0800
committerRafael Mendonça França <rafaelmfranca@gmail.com>2012-12-04 04:49:07 -0800
commit549da0dd8f88179485b45338bea383fe61775624 (patch)
treee45ee0a495f7f351e6f3d7822b62ab209e34132e /activerecord/test/models/developer.rb
parentdac811e8542ee7b9abb88a5839fa22dd59c7c737 (diff)
parent1b961765871eba76d50d463d3af6c3c5926f537a (diff)
downloadrails-549da0dd8f88179485b45338bea383fe61775624.tar.gz
rails-549da0dd8f88179485b45338bea383fe61775624.tar.bz2
rails-549da0dd8f88179485b45338bea383fe61775624.zip
Merge pull request #8413 from senny/8403_backport
backport #8403, no intermediate AR objects when eager loading.
Diffstat (limited to 'activerecord/test/models/developer.rb')
-rw-r--r--activerecord/test/models/developer.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/activerecord/test/models/developer.rb b/activerecord/test/models/developer.rb
index 4dc9fff9fd..a730d86586 100644
--- a/activerecord/test/models/developer.rb
+++ b/activerecord/test/models/developer.rb
@@ -63,6 +63,15 @@ class Developer < ActiveRecord::Base
self.all
end
end
+
+ after_find :track_instance_count
+ cattr_accessor :instance_count
+
+ def track_instance_count
+ self.class.instance_count ||= 0
+ self.class.instance_count += 1
+ end
+ private :track_instance_count
end
class AuditLog < ActiveRecord::Base