flyerhzm-bullet 1.5.7 → 1.5.8

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.5.7
1
+ 1.5.8
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{bullet}
8
- s.version = "1.5.7"
8
+ s.version = "1.5.8"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Richard Huang"]
@@ -31,7 +31,7 @@ module Bullet
31
31
  records = [records].flatten.compact.uniq
32
32
  return if records.empty?
33
33
  records.each do |record|
34
- Bullet::Association.add_association(record, associations)
34
+ Bullet::Association.add_object_associations(record, associations)
35
35
  end
36
36
  Bullet::Association.add_eager_loadings(records, associations)
37
37
  origin_preload_associations(records, associations, preload_options={})
@@ -50,10 +50,12 @@ module Bullet
50
50
  alias_method :origin_find_with_associations, :find_with_associations
51
51
  def find_with_associations(options)
52
52
  records = origin_find_with_associations(options)
53
+ associations = merge_includes(scope(:find, :include), options[:include])
53
54
  records.each do |record|
54
- Bullet::Association.add_association(record, merge_includes(scope(:find, :include), options[:include]))
55
+ Bullet::Association.add_object_associations(record, associations)
56
+ Bullet::Association.add_call_object_associations(record, associations)
55
57
  end
56
- Bullet::Association.add_eager_loadings(records, merge_includes(scope(:find, :include), options[:include]))
58
+ Bullet::Association.add_eager_loadings(records, associations)
57
59
  records
58
60
  end
59
61
  end
@@ -38,7 +38,7 @@ module Bullet
38
38
  unique(unused_preload_associations[klazz])
39
39
  end
40
40
 
41
- def add_association(object, associations)
41
+ def add_object_associations(object, associations)
42
42
  object_associations[object] ||= []
43
43
  object_associations[object] << associations
44
44
  unique(object_associations[object])
@@ -255,12 +255,10 @@ describe Bullet::Association, 'has_many' do
255
255
  end
256
256
 
257
257
  it "should not be unused preload post => category" do
258
- Post.in_category_name('first').all.each do |post|
259
- post.name
260
- end
258
+ Post.in_category_name('first').all.collect(&:name)
261
259
  Bullet::Association.should_not be_has_unpreload_associations
262
260
  Bullet::Association.check_unused_preload_associations
263
- Bullet::Association.should be_has_unused_preload_associations
261
+ Bullet::Association.should_not be_has_unused_preload_associations
264
262
  end
265
263
  end
266
264
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flyerhzm-bullet
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.7
4
+ version: 1.5.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Huang