ginjo-rfm 3.0.10 → 3.0.11
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.
- checksums.yaml +8 -8
- data/CHANGELOG.md +21 -0
- data/lib/rfm/VERSION +1 -1
- data/lib/rfm/base.rb +8 -3
- data/lib/rfm/record.rb +5 -2
- data/lib/rfm/utilities/compound_query.rb +1 -0
- data/lib/rfm/utilities/scope.rb +19 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
M2MxNTI1ZTEyNTc4NjNkYzQ3OTFlNDNlZTVjODFkN2FlNTBiZWUyNw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OGRkNjViNjkxNjQ5NWMzNWI3OGI3MzE4ZjQ2Zjk4MTYwZDU2N2ZmYw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MjM5ZGE5ODFjNmY0NDdhNzYxMDNhOTBjY2VlMDdkMTZhMGFkMDJiMWU2ZTVl
|
10
|
+
OWQzNmRiMDM5MjMzY2RhZjI2MTVkZWNiMTlkNjIyZWMzNTVjZmY5Y2QxODMx
|
11
|
+
NWRhZjI0OTQyYzhhODI5MzMzNmY3MjIyODI4NmU1NzM2ZjI3ODI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MGEyMzYxYmM2MjYyN2MyMjdmNzMxZmQzZDEzMDNiNjRhNzhiNTM0NjE0ZDMz
|
14
|
+
YjMyNDFkMTBhMTVmNWVhM2U4ZmIzMWZmZDZhODFjYjA3ZjVhMTYzMWJiNjlm
|
15
|
+
NTFhN2M3NjAwZjI4NGJmMjc4ZGZhNmUzNDQyOTViNjZiZmZkYTA=
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,26 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## Ginjo-Rfm 3.0.11
|
4
|
+
|
5
|
+
* Scoping fixes, changes, additions:
|
6
|
+
|
7
|
+
Now takes proc or array of hashes or hash.
|
8
|
+
|
9
|
+
Scope_args for scope proc now defaults to model instance.
|
10
|
+
|
11
|
+
Now handles omits - puts them at end of request array.
|
12
|
+
|
13
|
+
* Support for rom-fmp 0.0.4 - query chaining with compound fm queries.
|
14
|
+
|
15
|
+
* Basic support for portal field writes.
|
16
|
+
|
17
|
+
record['my_relationship::my_field.0'] = 'Adds a new portal record with data for my_field, if auto-create enabled'
|
18
|
+
record.update_attributes! 'my_relationship::my_field.3' => 'Updates my_field in 3rd portal record, if exists'
|
19
|
+
|
20
|
+
* Fix Base#save! to store raised exceptions in errors, if possible.
|
21
|
+
|
22
|
+
* Fix CompoundQuery to handle nil values in query params.
|
23
|
+
|
3
24
|
## Ginjo-Rfm 3.0.10
|
4
25
|
|
5
26
|
* Fixed bug where missing metadata would cause errors when creating/editing records.
|
data/lib/rfm/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.0.
|
1
|
+
3.0.11
|
data/lib/rfm/base.rb
CHANGED
@@ -151,7 +151,7 @@ module Rfm
|
|
151
151
|
def update_attributes(new_attr)
|
152
152
|
new_attr.each do |k,v|
|
153
153
|
k = k.to_s.downcase
|
154
|
-
if
|
154
|
+
if key?(k) || (layout.field_keys.include?(k.split('.')[0]) rescue nil)
|
155
155
|
@mods[k] = v
|
156
156
|
self[k] = v
|
157
157
|
else
|
@@ -201,14 +201,19 @@ module Rfm
|
|
201
201
|
else
|
202
202
|
self.create
|
203
203
|
end
|
204
|
+
rescue
|
205
|
+
(self.errors[:base] rescue []) << $!
|
206
|
+
raise $!
|
204
207
|
end
|
205
208
|
|
206
209
|
# Same as save!, but will not raise error.
|
207
210
|
def save
|
208
211
|
save!
|
212
|
+
# rescue
|
213
|
+
# (self.errors[:base] rescue []) << $!
|
214
|
+
# return nil
|
209
215
|
rescue
|
210
|
-
|
211
|
-
return nil
|
216
|
+
nil
|
212
217
|
end
|
213
218
|
|
214
219
|
# Just like Layout#save_if_not_modified, but with callbacks & validations.
|
data/lib/rfm/record.rb
CHANGED
@@ -209,8 +209,11 @@ module Rfm
|
|
209
209
|
|
210
210
|
def []=(key, val)
|
211
211
|
key_string = key.to_s.downcase
|
212
|
-
|
213
|
-
|
212
|
+
key_string_base = key_string.split('.')[0]
|
213
|
+
return super unless @loaded # is this needed? yes, for loading fresh records.
|
214
|
+
unless self.key?(key_string) || (layout.field_keys.include?(key_string_base) rescue nil)
|
215
|
+
raise Rfm::ParameterError, "You attempted to modify a field (#{key_string}) that does not exist in the current Filemaker layout."
|
216
|
+
end
|
214
217
|
# @mods[key_string] = val
|
215
218
|
# TODO: This needs cleaning up.
|
216
219
|
# TODO: can we get field_type from record instead?
|
data/lib/rfm/utilities/scope.rb
CHANGED
@@ -17,27 +17,40 @@ module Rfm
|
|
17
17
|
# instead of above scope constant.
|
18
18
|
|
19
19
|
def find(*args)
|
20
|
-
new_args = apply_scope(
|
20
|
+
new_args = apply_scope(args)
|
21
21
|
super(*new_args)
|
22
22
|
end
|
23
23
|
|
24
24
|
def count(*args)
|
25
|
-
new_args = apply_scope(
|
25
|
+
new_args = apply_scope(args)
|
26
26
|
super(*new_args)
|
27
27
|
end
|
28
28
|
|
29
|
-
# Mix scope requests with user requests
|
30
|
-
|
29
|
+
# Mix scope requests with user requests with a constraining AND logic.
|
30
|
+
# Also handles request options.
|
31
|
+
def apply_scope(args, input_scope=nil)
|
32
|
+
#puts "APPLY_SCOPE args:#{args} input_scope:#{input_scope}"
|
31
33
|
opts = (args.size > 1 && args.last.is_a?(Hash) ? args.pop : {})
|
32
|
-
|
34
|
+
scope_args = opts.delete(:scope_args) || self
|
35
|
+
raw_scope = input_scope || opts.delete(:scope) || self::SCOPE
|
36
|
+
scope = [raw_scope.is_a?(Proc) ? raw_scope.call(scope_args) : raw_scope].flatten.compact
|
37
|
+
#puts "APPLY_SCOPE scope:#{scope}"
|
38
|
+
|
33
39
|
return [args].flatten(1).push(opts) if !(args[0].is_a?(Array) || args[0].is_a?(Hash)) || scope.size < 1
|
34
40
|
scoped_requests = []
|
41
|
+
scope_omits = []
|
35
42
|
scope.each do |scope_req|
|
43
|
+
if scope_req[:omit]
|
44
|
+
scope_omits.push scope_req
|
45
|
+
next
|
46
|
+
end
|
36
47
|
[args].flatten.each do |req|
|
37
48
|
scoped_requests.push(req[:omit] ? req : req.merge(scope_req))
|
38
49
|
end
|
39
50
|
end
|
40
|
-
|
51
|
+
scoped_requests = [args].flatten if scoped_requests.empty?
|
52
|
+
scoped_query = [scoped_requests | scope_omits, opts]
|
53
|
+
#puts "APPLY SCOPE output:#{scoped_query}"
|
41
54
|
scoped_query
|
42
55
|
end
|
43
56
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ginjo-rfm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bill Richardson
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2015-09-
|
15
|
+
date: 2015-09-17 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: activemodel
|