dm-persevere-adapter 0.60.4 → 0.60.5
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/dm/associations/many_to_many.rb +15 -7
- data/lib/dm/query.rb +0 -1
- data/lib/persevere_adapter.rb +0 -1
- metadata +4 -13
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.60.
|
1
|
+
0.60.5
|
@@ -22,9 +22,12 @@ module DataMapper
|
|
22
22
|
|
23
23
|
def set(source, target)
|
24
24
|
assert_kind_of 'source', source, source_model
|
25
|
-
assert_kind_of 'target', target,
|
25
|
+
assert_kind_of 'target', target, Array
|
26
|
+
target.each {|item| assert_kind_of 'target array element', item, target_model }
|
26
27
|
lazy_load(source) unless loaded?(source)
|
27
|
-
|
28
|
+
# NOTE: This seems semantically wrong, a set should just erase the contents,
|
29
|
+
# not calculate the difference and replace the common elements...
|
30
|
+
get!(source).replace(target)
|
28
31
|
end
|
29
32
|
|
30
33
|
# Loads association targets and sets resulting value on
|
@@ -37,9 +40,10 @@ module DataMapper
|
|
37
40
|
#
|
38
41
|
# @api private
|
39
42
|
def lazy_load(source)
|
40
|
-
|
43
|
+
|
41
44
|
# SEL: load all related resources in the source collection
|
42
45
|
collection = source.collection
|
46
|
+
|
43
47
|
# if source.saved? && collection.size > 1 #OLD LINE --IRJ
|
44
48
|
if source.saved?
|
45
49
|
eager_load(collection)
|
@@ -102,7 +106,8 @@ module DataMapper
|
|
102
106
|
end
|
103
107
|
|
104
108
|
def inverse_name
|
105
|
-
|
109
|
+
self.prefix = "" if self.prefix.nil?
|
110
|
+
(self.prefix + Extlib::Inflection.underscore(Extlib::Inflection.demodulize(source_model.name)).pluralize).to_sym
|
106
111
|
end
|
107
112
|
|
108
113
|
# @api private
|
@@ -140,7 +145,7 @@ module DataMapper
|
|
140
145
|
resource.send(relationship.inverse.name)._original_add(source)
|
141
146
|
_original_add(resource)
|
142
147
|
end
|
143
|
-
|
148
|
+
|
144
149
|
alias :_original_concat :concat
|
145
150
|
def concat(resources)
|
146
151
|
inverse_add(*resources)
|
@@ -212,8 +217,11 @@ module DataMapper
|
|
212
217
|
removed = entries - other
|
213
218
|
new_resources = other - removed
|
214
219
|
resources_removed(removed)
|
215
|
-
removed.each{|r| r
|
216
|
-
new_resources.each
|
220
|
+
removed.each{ |r| delete(r) }
|
221
|
+
new_resources.each do |resource|
|
222
|
+
resource.send(relationship.inverse.name)._original_add(source)
|
223
|
+
_original_add(resource)
|
224
|
+
end
|
217
225
|
super(other)
|
218
226
|
end
|
219
227
|
|
data/lib/dm/query.rb
CHANGED
@@ -65,7 +65,6 @@ module DataMapper
|
|
65
65
|
result_string = Array.new
|
66
66
|
condition.value.to_a.each do |candidate|
|
67
67
|
if condition.subject.is_a?(DataMapper::Associations::Relationship)
|
68
|
-
# debugger
|
69
68
|
result_string << _fugly_munger(condition, candidate)
|
70
69
|
else
|
71
70
|
result_string << "#{condition.subject.name}=#{candidate}"
|
data/lib/persevere_adapter.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dm-persevere-adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 231
|
5
4
|
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 0
|
8
7
|
- 60
|
9
|
-
-
|
10
|
-
version: 0.60.
|
8
|
+
- 5
|
9
|
+
version: 0.60.5
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Ivan R. Judson
|
@@ -16,18 +15,16 @@ autorequire:
|
|
16
15
|
bindir: bin
|
17
16
|
cert_chain: []
|
18
17
|
|
19
|
-
date: 2010-06-
|
18
|
+
date: 2010-06-24 00:00:00 -06:00
|
20
19
|
default_executable:
|
21
20
|
dependencies:
|
22
21
|
- !ruby/object:Gem::Dependency
|
23
22
|
name: dm-core
|
24
23
|
prerelease: false
|
25
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
25
|
requirements:
|
28
26
|
- - ">="
|
29
27
|
- !ruby/object:Gem::Version
|
30
|
-
hash: 51
|
31
28
|
segments:
|
32
29
|
- 0
|
33
30
|
- 10
|
@@ -39,11 +36,9 @@ dependencies:
|
|
39
36
|
name: extlib
|
40
37
|
prerelease: false
|
41
38
|
requirement: &id002 !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
39
|
requirements:
|
44
40
|
- - ">="
|
45
41
|
- !ruby/object:Gem::Version
|
46
|
-
hash: 3
|
47
42
|
segments:
|
48
43
|
- 0
|
49
44
|
version: "0"
|
@@ -95,27 +90,23 @@ rdoc_options:
|
|
95
90
|
require_paths:
|
96
91
|
- lib
|
97
92
|
required_ruby_version: !ruby/object:Gem::Requirement
|
98
|
-
none: false
|
99
93
|
requirements:
|
100
94
|
- - ">="
|
101
95
|
- !ruby/object:Gem::Version
|
102
|
-
hash: 3
|
103
96
|
segments:
|
104
97
|
- 0
|
105
98
|
version: "0"
|
106
99
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
|
-
none: false
|
108
100
|
requirements:
|
109
101
|
- - ">="
|
110
102
|
- !ruby/object:Gem::Version
|
111
|
-
hash: 3
|
112
103
|
segments:
|
113
104
|
- 0
|
114
105
|
version: "0"
|
115
106
|
requirements: []
|
116
107
|
|
117
108
|
rubyforge_project:
|
118
|
-
rubygems_version: 1.3.
|
109
|
+
rubygems_version: 1.3.6
|
119
110
|
signing_key:
|
120
111
|
specification_version: 3
|
121
112
|
summary: A DataMapper Adapter for persevere
|