eager_record 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -49,11 +49,24 @@ generate two SQL queries. A couple of caveats:
49
49
 
50
50
  EagerRecord::ScopedPreloading.install
51
51
 
52
+ As an alternative to using this functionality, consider defining extra scoped
53
+ associations with `:readonly => true` as needed.
54
+
52
55
  === Does it work with all association types?
53
56
 
57
+ ==== Mostly...
58
+
54
59
  The test suite covers just about all of them; if you find one that doesn't work,
55
60
  please file an issue.
56
61
 
62
+ ==== Except!
63
+
64
+ There's a bug in ActiveRecord's preloading that causes it to build an invalid
65
+ query when preloading a `has_many :through` association that defines a
66
+ `:conditions` option that references the join table. For that reason,
67
+ EagerRecord does not attempt to eagerly load `has_many :through` associations
68
+ that have a `:conditions` option.
69
+
57
70
  === Do I need to make any changes to my code?
58
71
 
59
72
  EagerRecord doesn't add any new methods to ActiveRecord, so you don't need to
@@ -65,7 +65,7 @@ module EagerRecord
65
65
  end
66
66
 
67
67
  def load_target_with_eager_preloading
68
- if !@owner.new_record? || foreign_key_present
68
+ if @reflection.options[:conditions].nil? && (!@owner.new_record? || foreign_key_present)
69
69
  if !loaded?
70
70
  if originating_collection = @owner.instance_variable_get(:@originating_collection)
71
71
  @owner.class.__send__(:preload_associations, originating_collection, @reflection.name)
@@ -1,3 +1,3 @@
1
1
  module EagerRecord
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 0
9
- version: 0.1.0
8
+ - 1
9
+ version: 0.1.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Mat Brown
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-28 00:00:00 -04:00
17
+ date: 2010-06-04 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency