bullet 2.3.1 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. data/.travis.yml +5 -0
  2. data/Gemfile +3 -1
  3. data/Gemfile.lock +43 -32
  4. data/Gemfile.rails-2.3.14 +16 -0
  5. data/Gemfile.rails-2.3.14.lock +65 -0
  6. data/Gemfile.rails-3.0.12 +17 -0
  7. data/Gemfile.rails-3.0.12.lock +116 -0
  8. data/Gemfile.rails-3.1.4 +18 -0
  9. data/Gemfile.rails-3.1.4.lock +134 -0
  10. data/README.textile +5 -5
  11. data/lib/bullet.rb +15 -9
  12. data/lib/bullet/active_record2.rb +12 -0
  13. data/lib/bullet/active_record3.rb +12 -0
  14. data/lib/bullet/detector/association.rb +11 -12
  15. data/lib/bullet/detector/counter.rb +6 -6
  16. data/lib/bullet/detector/n_plus_one_query.rb +9 -9
  17. data/lib/bullet/detector/unused_eager_association.rb +9 -9
  18. data/lib/bullet/ext/object.rb +5 -0
  19. data/lib/bullet/ext/string.rb +5 -0
  20. data/lib/bullet/mongoid.rb +56 -0
  21. data/lib/bullet/registry/object.rb +4 -6
  22. data/lib/bullet/version.rb +1 -1
  23. data/spec/bullet/detector/association_spec.rb +14 -14
  24. data/spec/bullet/detector/counter_spec.rb +8 -9
  25. data/spec/bullet/detector/n_plus_one_query_spec.rb +22 -22
  26. data/spec/bullet/detector/unused_eager_association_spec.rb +7 -7
  27. data/spec/bullet/ext/object_spec.rb +20 -0
  28. data/spec/bullet/ext/string_spec.rb +13 -0
  29. data/spec/bullet/registry/object_spec.rb +4 -4
  30. data/spec/integration/association_spec.rb +463 -401
  31. data/spec/integration/counter_spec.rb +27 -25
  32. data/spec/integration/mongoid/association_spec.rb +276 -0
  33. data/spec/integration/rails2/association_spec.rb +593 -0
  34. data/spec/integration/rails2/counter_spec.rb +39 -0
  35. data/spec/models/mongoid/address.rb +5 -0
  36. data/spec/models/mongoid/category.rb +6 -0
  37. data/spec/models/mongoid/comment.rb +5 -0
  38. data/spec/models/mongoid/company.rb +5 -0
  39. data/spec/models/mongoid/entry.rb +5 -0
  40. data/spec/models/mongoid/post.rb +8 -0
  41. data/spec/models/post.rb +12 -6
  42. data/spec/spec_helper.rb +32 -8
  43. data/spec/support/bullet_ext.rb +1 -1
  44. data/spec/support/mongo_seed.rb +41 -0
  45. data/spec/support/{seed.rb → sqlite_seed.rb} +1 -22
  46. data/test.result +2293 -0
  47. metadata +42 -22
  48. data/spec/integration/association_for_chris_spec.rb +0 -37
  49. data/spec/integration/association_for_peschkaj_spec.rb +0 -26
  50. data/spec/models/contact.rb +0 -3
  51. data/spec/models/deal.rb +0 -4
  52. data/spec/models/email.rb +0 -3
  53. data/spec/models/hotel.rb +0 -4
  54. data/spec/models/location.rb +0 -3
@@ -2,11 +2,11 @@ h1. Bullet !https://gemnasium.com/flyerhzm/bullet.png?travis(Dependency Status)!
2
2
 
3
3
  !https://secure.travis-ci.org/flyerhzm/bullet.png!:http://travis-ci.org/flyerhzm/bullet
4
4
 
5
- The Bullet plugin/gem is designed to help you increase your application's performance by reducing the number of queries it makes. It will watch your queries while you develop your application and notify you when you should add eager loading (N+1 queries), when you're using eager loading that isn't necessary and when you should use counter cache.
5
+ The Bullet gem is designed to help you increase your application's performance by reducing the number of queries it makes. It will watch your queries while you develop your application and notify you when you should add eager loading (N+1 queries), when you're using eager loading that isn't necessary and when you should use counter cache.
6
6
 
7
7
  Best practice is to use Bullet in development mode or custom mode (staging, profile, etc.). The last thing you want is your clients getting alerts about how lazy you are.
8
8
 
9
- The Bullet plugin/gem now supports rails 2.1, 2.2, 2.3, 3.0, 3.1 and 3.2.
9
+ The Bullet gem now supports **activerecord** 2.1, 2.2, 2.3, 3.0, 3.1, 3.2 and **mongoid** >= 2.4.1.
10
10
 
11
11
  ****************************************************************************
12
12
 
@@ -46,7 +46,7 @@ end
46
46
  The notifier of bullet is a wrap of "uniform_notifier":https://github.com/flyerhzm/uniform_notifier
47
47
 
48
48
  The code above will enable all six of the Bullet notification systems:
49
- * <code>Bullet.enable</code>: enable Bullet plugin/gem, otherwise do nothing
49
+ * <code>Bullet.enable</code>: enable Bullet gem, otherwise do nothing
50
50
  * <code>Bullet.alert</code>: pop up a JavaScript alert in the browser
51
51
  * <code>Bullet.bullet_logger</code>: log to the Bullet log file (Rails.root/log/bullet.log)
52
52
  * <code>Bullet.rails_logger</code>: add warnings directly to the Rails log
@@ -127,7 +127,7 @@ If you find bullet does not work for you, *please disable your browser's cache*.
127
127
 
128
128
  h2. Advance
129
129
 
130
- The bullet plugin/gem use rack middleware for http request. If you want to bullet for without http server, such as job server. You can do like this:
130
+ The bullet gem use rack middleware for http request. If you want to bullet for without http server, such as job server. You can do like this:
131
131
 
132
132
  <pre><code>
133
133
  Bullet.start_request if Bullet.enable?
@@ -233,7 +233,7 @@ And run
233
233
 
234
234
  <pre><code>bundle install</code></pre>
235
235
 
236
- 6. enable the bullet plugin in development, add a line to <code>config/environments/development.rb</code>
236
+ 6. enable the bullet gem in development, add a line to <code>config/environments/development.rb</code>
237
237
 
238
238
  <pre><code>
239
239
  config.after_initialize do
@@ -1,11 +1,7 @@
1
1
  require 'set'
2
2
  require 'uniform_notifier'
3
-
4
- class Object
5
- def ar_key
6
- "#{self.class}:#{self.id}"
7
- end
8
- end
3
+ require 'bullet/ext/object'
4
+ require 'bullet/ext/string'
9
5
 
10
6
  module Bullet
11
7
  if Rails.version =~ /\A3\.0/
@@ -16,6 +12,7 @@ module Bullet
16
12
  autoload :ActiveRecord, 'bullet/active_record2'
17
13
  autoload :ActionController, 'bullet/action_controller2'
18
14
  end
15
+ autoload :Mongoid, 'bullet/mongoid'
19
16
  autoload :Rack, 'bullet/rack'
20
17
  autoload :BulletLogger, 'bullet/logger'
21
18
  autoload :Notification, 'bullet/notification'
@@ -44,9 +41,18 @@ module Bullet
44
41
  def enable=(enable)
45
42
  @enable = enable
46
43
  if enable?
47
- Bullet::ActiveRecord.enable
48
- if Rails.version =~ /\A2./
49
- Bullet::ActionController.enable
44
+ begin
45
+ require 'mongoid'
46
+ Bullet::Mongoid.enable
47
+ rescue LoadError
48
+ end
49
+ begin
50
+ require 'active_record'
51
+ Bullet::ActiveRecord.enable
52
+ if Rails.version =~ /\A2./
53
+ Bullet::ActionController.enable
54
+ end
55
+ rescue LoadError
50
56
  end
51
57
  end
52
58
  end
@@ -73,6 +73,18 @@ module Bullet
73
73
  Bullet::Detector::NPlusOneQuery.call_association(@owner, @reflection.name)
74
74
  origin_load_target
75
75
  end
76
+
77
+ alias_method :origin_first, :first
78
+ def first(*args)
79
+ Bullet::Detector::NPlusOneQuery.call_association(@owner, @reflection.name)
80
+ origin_first(*args)
81
+ end
82
+
83
+ alias_method :origin_last, :last
84
+ def last(*args)
85
+ Bullet::Detector::NPlusOneQuery.call_association(@owner, @reflection.name)
86
+ origin_last(*args)
87
+ end
76
88
  end
77
89
 
78
90
  ::ActiveRecord::Associations::AssociationProxy.class_eval do
@@ -67,6 +67,18 @@ module Bullet
67
67
  Bullet::Detector::NPlusOneQuery.call_association(@owner, @reflection.name)
68
68
  origin_load_target
69
69
  end
70
+
71
+ alias_method :origin_first, :first
72
+ def first(*args)
73
+ Bullet::Detector::NPlusOneQuery.call_association(@owner, @reflection.name)
74
+ origin_first(*args)
75
+ end
76
+
77
+ alias_method :origin_last, :last
78
+ def last(*args)
79
+ Bullet::Detector::NPlusOneQuery.call_association(@owner, @reflection.name)
80
+ origin_last(*args)
81
+ end
70
82
  end
71
83
 
72
84
  ::ActiveRecord::Associations::AssociationProxy.class_eval do
@@ -20,34 +20,33 @@ module Bullet
20
20
  end
21
21
 
22
22
  def add_object_associations(object, associations)
23
- object_associations.add(object.ar_key, associations) if object.id
23
+ object_associations.add(object.bullet_ar_key, associations) if object.id
24
24
  end
25
25
 
26
26
  def add_call_object_associations(object, associations)
27
- call_object_associations.add(object.ar_key, associations) if object.id
27
+ call_object_associations.add(object.bullet_ar_key, associations) if object.id
28
28
  end
29
29
 
30
30
  def add_possible_objects(object_or_objects)
31
+ return unless object_or_objects
31
32
  if object_or_objects.is_a? Array
32
- object_or_objects.each { |object| possible_objects.add object.ar_key }
33
- elsif object_or_objects.is_a? ::ActiveRecord::Base
34
- possible_objects.add object_or_objects.ar_key if object_or_objects.id
33
+ object_or_objects.each { |object| possible_objects.add object.bullet_ar_key }
35
34
  else
36
- # do nothing
35
+ possible_objects.add object_or_objects.bullet_ar_key if object_or_objects.id
37
36
  end
38
37
  end
39
38
 
40
39
  def add_impossible_object(object)
41
- impossible_objects.add object.ar_key if object.id
40
+ impossible_objects.add object.bullet_ar_key if object.id
42
41
  end
43
42
 
44
43
  def add_eager_loadings(objects, associations)
45
- object_ar_keys = objects.map(&:ar_key)
44
+ bullet_ar_keys = objects.map(&:bullet_ar_key)
46
45
 
47
46
  to_add = nil
48
47
  to_merge, to_delete = [], []
49
48
  eager_loadings.each do |k, v|
50
- key_objects_overlap = k & object_ar_keys
49
+ key_objects_overlap = k & bullet_ar_keys
51
50
 
52
51
  next if key_objects_overlap.empty?
53
52
 
@@ -57,10 +56,10 @@ module Bullet
57
56
  else
58
57
  to_merge << [key_objects_overlap, ( eager_loadings[k].dup << associations )]
59
58
 
60
- keys_without_objects = k - object_ar_keys
59
+ keys_without_objects = k - bullet_ar_keys
61
60
  to_merge << [keys_without_objects, eager_loadings[k]]
62
61
  to_delete << k
63
- object_ar_keys = object_ar_keys - k
62
+ bullet_ar_keys = bullet_ar_keys - k
64
63
  end
65
64
  end
66
65
 
@@ -68,7 +67,7 @@ module Bullet
68
67
  to_merge.each { |k,val| eager_loadings.merge k, val }
69
68
  to_delete.each { |k| eager_loadings.delete k }
70
69
 
71
- eager_loadings.add object_ar_keys, associations unless object_ar_keys.empty?
70
+ eager_loadings.add bullet_ar_keys, associations unless bullet_ar_keys.empty?
72
71
  end
73
72
 
74
73
  private
@@ -8,21 +8,21 @@ module Bullet
8
8
  end
9
9
 
10
10
  def add_counter_cache(object, associations)
11
- if conditions_met?(object.ar_key, associations)
11
+ if conditions_met?(object.bullet_ar_key, associations)
12
12
  create_notification object.class.to_s, associations
13
13
  end
14
14
  end
15
15
 
16
16
  def add_possible_objects(object_or_objects)
17
17
  if object_or_objects.is_a? Array
18
- object_or_objects.each { |object| possible_objects.add object.ar_key }
18
+ object_or_objects.each { |object| possible_objects.add object.bullet_ar_key }
19
19
  else
20
- possible_objects.add object_or_objects.ar_key
20
+ possible_objects.add object_or_objects.bullet_ar_key
21
21
  end
22
22
  end
23
23
 
24
24
  def add_impossible_object(object)
25
- impossible_objects.add object.ar_key
25
+ impossible_objects.add object.bullet_ar_key
26
26
  end
27
27
 
28
28
  private
@@ -39,8 +39,8 @@ module Bullet
39
39
  @@impossible_objects ||= Bullet::Registry::Object.new
40
40
  end
41
41
 
42
- def conditions_met?(object_ar_key, associations)
43
- possible_objects.include?(object_ar_key) && !impossible_objects.include?(object_ar_key)
42
+ def conditions_met?(bullet_ar_key, associations)
43
+ possible_objects.include?(bullet_ar_key) && !impossible_objects.include?(bullet_ar_key)
44
44
  end
45
45
  end
46
46
  end
@@ -10,7 +10,7 @@ module Bullet
10
10
  @@checked = true
11
11
  add_call_object_associations(object, associations)
12
12
 
13
- if conditions_met?(object.ar_key, associations)
13
+ if conditions_met?(object.bullet_ar_key, associations)
14
14
  create_notification caller_in_project, object.class.to_s, associations
15
15
  end
16
16
  end
@@ -22,8 +22,8 @@ module Bullet
22
22
  end
23
23
 
24
24
  # decide whether the object.associations is unpreloaded or not.
25
- def conditions_met?(object_ar_key, associations)
26
- possible?(object_ar_key) && !impossible?(object_ar_key) && !association?(object_ar_key, associations)
25
+ def conditions_met?(bullet_ar_key, associations)
26
+ possible?(bullet_ar_key) && !impossible?(bullet_ar_key) && !association?(bullet_ar_key, associations)
27
27
  end
28
28
 
29
29
  def caller_in_project
@@ -32,17 +32,17 @@ module Bullet
32
32
  caller.select { |c| c.include?(rails_root) && !c.include?(vendor_root) }
33
33
  end
34
34
 
35
- def possible?(object_ar_key)
36
- possible_objects.include? object_ar_key
35
+ def possible?(bullet_ar_key)
36
+ possible_objects.include? bullet_ar_key
37
37
  end
38
38
 
39
- def impossible?(object_ar_key)
40
- impossible_objects.include? object_ar_key
39
+ def impossible?(bullet_ar_key)
40
+ impossible_objects.include? bullet_ar_key
41
41
  end
42
42
 
43
43
  # check if object => associations already exists in object_associations.
44
- def association?(object_ar_key, associations)
45
- value = object_associations[object_ar_key]
44
+ def association?(bullet_ar_key, associations)
45
+ value = object_associations[bullet_ar_key]
46
46
  if value
47
47
  value.each do |v|
48
48
  result = v.is_a?(Hash) ? v.has_key?(associations) : v == associations
@@ -8,11 +8,11 @@ module Bullet
8
8
  # if association not in call_object_association, then the object => association - call_object_association is ununsed preload assocations
9
9
  def check_unused_preload_associations
10
10
  @@checked = true
11
- object_associations.each do |object_ar_key, association|
12
- object_association_diff = diff_object_association object_ar_key, association
11
+ object_associations.each do |bullet_ar_key, associations|
12
+ object_association_diff = diff_object_associations bullet_ar_key, associations
13
13
  next if object_association_diff.empty?
14
14
 
15
- create_notification object_ar_key.split(":").first, object_association_diff
15
+ create_notification bullet_ar_key.bullet_class_name, object_association_diff
16
16
  end
17
17
  end
18
18
 
@@ -22,19 +22,19 @@ module Bullet
22
22
  Bullet.notification_collector.add(notice)
23
23
  end
24
24
 
25
- def call_associations(object_ar_key, association)
25
+ def call_associations(bullet_ar_key, associations)
26
26
  all = Set.new
27
- eager_loadings.similarly_associated(object_ar_key, association).each do |related_object_ar_key|
28
- coa = call_object_associations[related_object_ar_key]
27
+ eager_loadings.similarly_associated(bullet_ar_key, associations).each do |related_bullet_ar_key|
28
+ coa = call_object_associations[related_bullet_ar_key]
29
29
  next if coa.nil?
30
30
  all.merge coa
31
31
  end
32
32
  all.to_a
33
33
  end
34
34
 
35
- def diff_object_association(object_ar_key, association)
36
- potential_objects = association - call_associations(object_ar_key, association)
37
- potential_objects.reject { |a| a.is_a?(Hash) }
35
+ def diff_object_associations(bullet_ar_key, associations)
36
+ potential_associations = associations - call_associations(bullet_ar_key, associations)
37
+ potential_associations.reject { |a| a.is_a?(Hash) }
38
38
  end
39
39
  end
40
40
  end
@@ -0,0 +1,5 @@
1
+ class Object
2
+ def bullet_ar_key
3
+ "#{self.class}:#{self.id}"
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class String
2
+ def bullet_class_name
3
+ self.sub(/:[^:]*?$/, "")
4
+ end
5
+ end
@@ -0,0 +1,56 @@
1
+ module Bullet
2
+ module Mongoid
3
+ def self.enable
4
+ require 'mongoid'
5
+ ::Mongoid::Contexts::Mongo.class_eval do
6
+ alias_method :origin_first, :first
7
+ alias_method :origin_last, :last
8
+ alias_method :origin_iterate, :iterate
9
+
10
+ def first
11
+ result = origin_first
12
+ Bullet::Detector::Association.add_impossible_object(result)
13
+ result
14
+ end
15
+
16
+ def last
17
+ result = origin_last
18
+ Bullet::Detector::Association.add_impossible_object(result)
19
+ result
20
+ end
21
+
22
+ def iterate(&block)
23
+ records = execute.to_a
24
+ if records.size > 1
25
+ Bullet::Detector::Association.add_possible_objects(records)
26
+ elsif records.size == 1
27
+ Bullet::Detector::Association.add_impossible_object(records.first)
28
+ end
29
+ origin_iterate(&block)
30
+ end
31
+ end
32
+
33
+ ::Mongoid::Relations::Accessors.class_eval do
34
+ alias_method :origin_set_relation, :set_relation
35
+
36
+ def set_relation(name, relation)
37
+ Bullet::Detector::NPlusOneQuery.call_association(self, name)
38
+ origin_set_relation(name, relation)
39
+ end
40
+ end
41
+
42
+ ::Mongoid::Contexts::Mongo.class_eval do
43
+ alias_method :origin_eager_load, :eager_load
44
+
45
+ def eager_load(docs)
46
+ associations = criteria.inclusions.map(&:name)
47
+ docs.each do |doc|
48
+ Bullet::Detector::Association.add_object_associations(doc, associations)
49
+ end
50
+ Bullet::Detector::Association.add_eager_loadings(docs, associations)
51
+ origin_eager_load(docs)
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
@@ -1,14 +1,12 @@
1
1
  module Bullet
2
2
  module Registry
3
3
  class Object < Base
4
- def add(object_ar_key)
5
- klazz = object_ar_key.split(":").first
6
- super(klazz, object_ar_key)
4
+ def add(bullet_ar_key)
5
+ super(bullet_ar_key.bullet_class_name, bullet_ar_key)
7
6
  end
8
7
 
9
- def include?(object_ar_key)
10
- klazz = object_ar_key.split(":").first
11
- super(klazz, object_ar_key)
8
+ def include?(bullet_ar_key)
9
+ super(bullet_ar_key.bullet_class_name, bullet_ar_key)
12
10
  end
13
11
  end
14
12
  end
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
  module Bullet
3
- VERSION = "2.3.1"
3
+ VERSION = "4.0.0"
4
4
  end
5
5
 
@@ -30,22 +30,22 @@ module Bullet
30
30
  context ".add_object_association" do
31
31
  it "should add object, associations pair" do
32
32
  Association.add_object_associations(@post1, :associations)
33
- Association.send(:object_associations).should be_include(@post1.ar_key, :associations)
33
+ Association.send(:object_associations).should be_include(@post1.bullet_ar_key, :associations)
34
34
  end
35
35
  end
36
36
 
37
37
  context ".add_call_object_associations" do
38
38
  it "should add call object, associations pair" do
39
39
  Association.add_call_object_associations(@post1, :associations)
40
- Association.send(:call_object_associations).should be_include(@post1.ar_key, :associations)
40
+ Association.send(:call_object_associations).should be_include(@post1.bullet_ar_key, :associations)
41
41
  end
42
42
  end
43
43
 
44
44
  context ".add_possible_objects" do
45
45
  it "should add possible objects" do
46
46
  Association.add_possible_objects([@post1, @post2])
47
- Association.send(:possible_objects).should be_include(@post1.ar_key)
48
- Association.send(:possible_objects).should be_include(@post2.ar_key)
47
+ Association.send(:possible_objects).should be_include(@post1.bullet_ar_key)
48
+ Association.send(:possible_objects).should be_include(@post2.bullet_ar_key)
49
49
  end
50
50
 
51
51
  it "should not raise error if object is nil" do
@@ -56,37 +56,37 @@ module Bullet
56
56
  context ".add_impossible_object" do
57
57
  it "should add impossible object" do
58
58
  Association.add_impossible_object(@post1)
59
- Association.send(:impossible_objects).should be_include(@post1.ar_key)
59
+ Association.send(:impossible_objects).should be_include(@post1.bullet_ar_key)
60
60
  end
61
61
  end
62
62
 
63
63
  context ".add_eager_loadings" do
64
64
  it "should add objects, associations pair when eager_loadings are empty" do
65
65
  Association.add_eager_loadings([@post1, @post2], :associations)
66
- Association.send(:eager_loadings).should be_include([@post1.ar_key, @post2.ar_key], :associations)
66
+ Association.send(:eager_loadings).should be_include([@post1.bullet_ar_key, @post2.bullet_ar_key], :associations)
67
67
  end
68
68
 
69
69
  it "should add objects, associations pair for existing eager_loadings" do
70
70
  Association.add_eager_loadings([@post1, @post2], :association1)
71
71
  Association.add_eager_loadings([@post1, @post2], :association2)
72
- Association.send(:eager_loadings).should be_include([@post1.ar_key, @post2.ar_key], :association1)
73
- Association.send(:eager_loadings).should be_include([@post1.ar_key, @post2.ar_key], :association2)
72
+ Association.send(:eager_loadings).should be_include([@post1.bullet_ar_key, @post2.bullet_ar_key], :association1)
73
+ Association.send(:eager_loadings).should be_include([@post1.bullet_ar_key, @post2.bullet_ar_key], :association2)
74
74
  end
75
75
 
76
76
  it "should merge objects, associations pair for existing eager_loadings" do
77
77
  Association.add_eager_loadings([@post1], :association1)
78
78
  Association.add_eager_loadings([@post1, @post2], :association2)
79
- Association.send(:eager_loadings).should be_include([@post1.ar_key], :association1)
80
- Association.send(:eager_loadings).should be_include([@post1.ar_key], :association2)
81
- Association.send(:eager_loadings).should be_include([@post1.ar_key, @post2.ar_key], :association2)
79
+ Association.send(:eager_loadings).should be_include([@post1.bullet_ar_key], :association1)
80
+ Association.send(:eager_loadings).should be_include([@post1.bullet_ar_key], :association2)
81
+ Association.send(:eager_loadings).should be_include([@post1.bullet_ar_key, @post2.bullet_ar_key], :association2)
82
82
  end
83
83
 
84
84
  it "should delete objects, associations pair for existing eager_loadings" do
85
85
  Association.add_eager_loadings([@post1, @post2], :association1)
86
86
  Association.add_eager_loadings([@post1], :association2)
87
- Association.send(:eager_loadings).should be_include([@post1.ar_key], :association1)
88
- Association.send(:eager_loadings).should be_include([@post1.ar_key], :association2)
89
- Association.send(:eager_loadings).should be_include([@post2.ar_key], :association1)
87
+ Association.send(:eager_loadings).should be_include([@post1.bullet_ar_key], :association1)
88
+ Association.send(:eager_loadings).should be_include([@post1.bullet_ar_key], :association2)
89
+ Association.send(:eager_loadings).should be_include([@post2.bullet_ar_key], :association1)
90
90
  end
91
91
  end
92
92
  end