zeal 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.md +1 -1
  2. data/lib/zeal.rb +6 -2
  3. data/lib/zeal/version.rb +1 -1
  4. metadata +2 -2
data/README.md CHANGED
@@ -54,7 +54,7 @@ end
54
54
  Zeal.eager_load(@users, :friends, :countrymen)
55
55
 
56
56
  # or alternately
57
- @users.extend(Zeal).eager_load(@users, :friends, :countrymen)
57
+ @users.extend(Zeal).eager_load(:friends, :countrymen)
58
58
  ```
59
59
 
60
60
  Your choice!
data/lib/zeal.rb CHANGED
@@ -6,12 +6,16 @@ module Zeal
6
6
  class << self
7
7
  if Rails.version.to_s =~ /^3/
8
8
  def eager_load(collection, *args)
9
- ActiveRecord::Associations::Preloader.new(collection, args).run
9
+ if collection.length > 0
10
+ ActiveRecord::Associations::Preloader.new(collection, args).run
11
+ end
10
12
  collection
11
13
  end
12
14
  else
13
15
  def eager_load(collection, *args)
14
- class_of_collection(collection).send(:preload_associations, collection, args)
16
+ if collection.length > 0
17
+ class_of_collection(collection).send(:preload_associations, collection, args)
18
+ end
15
19
  collection
16
20
  end
17
21
  end
data/lib/zeal/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Zeal
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zeal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-29 00:00:00.000000000 Z
12
+ date: 2011-11-30 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Zeal allows you to eager-load associations on ActiveRecord objects that
15
15
  have already been loaded from the database.