services 4.1.2 → 4.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/services/base.rb +7 -2
- data/lib/services/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb7f8fa1f247c8cd78f746ed04c37863d306d576
|
4
|
+
data.tar.gz: 00477c2e76f2d8c08eb1baa32af0ff826ea35d8b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ebc5ae0f75cbdc234dd491f0e83a8ca31acf3f3d2db1028c22b2891a5a255c1601c9b2a944dd084927e7ae3a3c2683d68093458023976ca0e6762fe5c7c5c6c
|
7
|
+
data.tar.gz: dd8d2c6ea38ca439d70246adab1345921086bfc41b1c1f341f75dc09b82fafea53fc9d52329c3f163a42b103353822a3af8ec6ebd43fb2a87beec0562b3e261c
|
data/lib/services/base.rb
CHANGED
@@ -46,11 +46,16 @@ module Services
|
|
46
46
|
ids
|
47
47
|
end
|
48
48
|
|
49
|
+
def find_service(klass)
|
50
|
+
find_service_name = "#{klass.to_s.pluralize}::Find"
|
51
|
+
candidates = [find_service_name, "Services::#{find_service_name}"]
|
52
|
+
candidates.map(&:safe_constantize).compact.first or raise self.class::Error, "Could not find find service (tried: #{candidates.join(', ')})"
|
53
|
+
end
|
54
|
+
|
49
55
|
def find_objects(ids_or_objects, klass = object_class)
|
50
56
|
ids, objects = _split_ids_and_objects(ids_or_objects, klass)
|
51
57
|
if ids.any?
|
52
|
-
|
53
|
-
objects_from_ids = find_service.constantize.call(ids)
|
58
|
+
objects_from_ids = find_service(klass).call(ids)
|
54
59
|
object_ids = if objects_from_ids.respond_to?(:pluck)
|
55
60
|
objects_from_ids.pluck(:id)
|
56
61
|
else
|
data/lib/services/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: services
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.1.
|
4
|
+
version: 4.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Manuel Meurer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|