eager_record 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +13 -0
- data/lib/eager_record/eager_preloading.rb +1 -1
- data/lib/eager_record/version.rb +1 -1
- metadata +3 -3
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)
|
data/lib/eager_record/version.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
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-
|
17
|
+
date: 2010-06-04 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|