eager_record 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/eager_record.rb +1 -0
- data/lib/eager_record/eager_preloading.rb +1 -1
- data/lib/eager_record/unmarshallable.rb +34 -0
- data/lib/eager_record/version.rb +1 -1
- metadata +14 -6
data/lib/eager_record.rb
CHANGED
@@ -6,6 +6,7 @@ module EagerRecord
|
|
6
6
|
autoload :VERSION, File.join(File.dirname(__FILE__), 'eager_record', 'version')
|
7
7
|
autoload :EagerPreloading, File.join(File.dirname(__FILE__), 'eager_record', 'eager_preloading')
|
8
8
|
autoload :ScopedPreloading, File.join(File.dirname(__FILE__), 'eager_record', 'scoped_preloading')
|
9
|
+
autoload :Unmarshallable, File.join(File.dirname(__FILE__), 'eager_record', 'unmarshallable')
|
9
10
|
|
10
11
|
class <<self
|
11
12
|
def install
|
@@ -23,7 +23,7 @@ module EagerRecord
|
|
23
23
|
grouped_collections.values.each do |grouped_collection|
|
24
24
|
if grouped_collection.length > 1
|
25
25
|
grouped_collection.each do |record|
|
26
|
-
record.instance_variable_set(:@originating_collection, grouped_collection)
|
26
|
+
record.instance_variable_set(:@originating_collection, Unmarshallable.new(grouped_collection))
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module EagerRecord
|
2
|
+
#
|
3
|
+
# A wrapper for objects that we don't want to marshal. In particular, used
|
4
|
+
# to wrap the @originating_collection array that is created in model instances
|
5
|
+
# since marshalling that seems a bad idea.
|
6
|
+
#
|
7
|
+
class Unmarshallable
|
8
|
+
instance_methods.each do |method|
|
9
|
+
undef_method(method) unless method =~ /__.+__/ || method.to_sym == :respond_to?
|
10
|
+
end
|
11
|
+
|
12
|
+
class <<self
|
13
|
+
def _load(dump)
|
14
|
+
nil
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def initialize(underlying)
|
19
|
+
@underlying = underlying
|
20
|
+
end
|
21
|
+
|
22
|
+
def method_missing(method, *args, &block)
|
23
|
+
@underlying.__send__(method, *args, &block)
|
24
|
+
end
|
25
|
+
|
26
|
+
def respond_to?(method)
|
27
|
+
super || @underlying.respond_to?(method)
|
28
|
+
end
|
29
|
+
|
30
|
+
def _dump(depth)
|
31
|
+
Marshal.dump(nil)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/eager_record/version.rb
CHANGED
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eager_record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 31
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Mat Brown
|
@@ -14,16 +15,18 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-06-
|
18
|
+
date: 2010-06-21 00:00:00 -04:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
22
|
name: rspec
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
27
|
- - ">="
|
26
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
27
30
|
segments:
|
28
31
|
- 0
|
29
32
|
version: "0"
|
@@ -39,10 +42,11 @@ extra_rdoc_files: []
|
|
39
42
|
|
40
43
|
files:
|
41
44
|
- rails/init.rb
|
42
|
-
- lib/eager_record.rb
|
43
|
-
- lib/eager_record/scoped_preloading.rb
|
44
45
|
- lib/eager_record/version.rb
|
46
|
+
- lib/eager_record/unmarshallable.rb
|
47
|
+
- lib/eager_record/scoped_preloading.rb
|
45
48
|
- lib/eager_record/eager_preloading.rb
|
49
|
+
- lib/eager_record.rb
|
46
50
|
- README.rdoc
|
47
51
|
- History.txt
|
48
52
|
has_rdoc: true
|
@@ -55,23 +59,27 @@ rdoc_options: []
|
|
55
59
|
require_paths:
|
56
60
|
- lib
|
57
61
|
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
+
none: false
|
58
63
|
requirements:
|
59
64
|
- - ">="
|
60
65
|
- !ruby/object:Gem::Version
|
66
|
+
hash: 3
|
61
67
|
segments:
|
62
68
|
- 0
|
63
69
|
version: "0"
|
64
70
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
65
72
|
requirements:
|
66
73
|
- - ">="
|
67
74
|
- !ruby/object:Gem::Version
|
75
|
+
hash: 3
|
68
76
|
segments:
|
69
77
|
- 0
|
70
78
|
version: "0"
|
71
79
|
requirements: []
|
72
80
|
|
73
81
|
rubyforge_project: eager_record
|
74
|
-
rubygems_version: 1.3.
|
82
|
+
rubygems_version: 1.3.7
|
75
83
|
signing_key:
|
76
84
|
specification_version: 3
|
77
85
|
summary: Automatic association preloading for ActiveRecord collections.
|