somehow_has_relation 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/somehow_has_relation/version.rb +1 -1
- data/lib/somehow_has_relation.rb +3 -3
- metadata +4 -4
data/lib/somehow_has_relation.rb
CHANGED
@@ -27,7 +27,7 @@ module SomehowHasRelation
|
|
27
27
|
define_method(related) do
|
28
28
|
found = somehow_found_or_recur relation, current_options[:if], current_options
|
29
29
|
if current_options.has_key?(:one)
|
30
|
-
found.flatten.compact.first rescue
|
30
|
+
found.flatten.compact.first rescue nil
|
31
31
|
elsif current_options.has_key?(:many)
|
32
32
|
found.flatten.compact rescue []
|
33
33
|
end
|
@@ -58,7 +58,7 @@ module SomehowHasRelation
|
|
58
58
|
if opt.has_key?(:through)
|
59
59
|
found << somehow_recur(relation, opt[:through], opt[:if])
|
60
60
|
else
|
61
|
-
return send_and_filter(relation, condition)
|
61
|
+
return [send_and_filter(relation, condition)]
|
62
62
|
end
|
63
63
|
rescue
|
64
64
|
found << []
|
@@ -67,7 +67,7 @@ module SomehowHasRelation
|
|
67
67
|
|
68
68
|
found
|
69
69
|
else
|
70
|
-
send_and_filter(relation, condition)
|
70
|
+
[send_and_filter(relation, condition)]
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: somehow_has_relation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 7
|
10
|
+
version: 0.0.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Matteo Latini
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-03-
|
18
|
+
date: 2011-03-23 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|