webink 1.3.1 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/webink/database.rb +1 -1
- data/lib/webink/model.rb +1 -1
- metadata +2 -2
data/lib/webink/database.rb
CHANGED
@@ -332,7 +332,7 @@ module Ink
|
|
332
332
|
# [param class1_id:] Primary key value of the reference classname
|
333
333
|
# [param class2:] Match classname or class
|
334
334
|
# [param params:] Additional SQL syntax like GROUP BY (optional)
|
335
|
-
# [returns:] single class2 instance from the SQL result set
|
335
|
+
# [returns:] single class2 instance from the SQL result set or nil
|
336
336
|
def find_reference(class1, class1_id, class2, params="")
|
337
337
|
result_array = self.find_references class1, class1_id, class2, params
|
338
338
|
if result_array.length == 1
|
data/lib/webink/model.rb
CHANGED
@@ -232,7 +232,7 @@ module Ink
|
|
232
232
|
relationship = self.class.foreign[c.class_name]
|
233
233
|
if relationship
|
234
234
|
result_array = (relationship == "many_many") ? Ink::Database.database.find_union(self.class, self.pk, c) : Ink::Database.database.find_references(self.class, self.pk, c)
|
235
|
-
instance_variable_set("@#{c.table_name}", (relationship =~ /
|
235
|
+
instance_variable_set("@#{c.table_name}", (relationship =~ /^one_/) ? result_array[0] : result_array)
|
236
236
|
true
|
237
237
|
else
|
238
238
|
false
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: webink
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.3.
|
5
|
+
version: 1.3.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Matthias Geier
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-10-05 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: fcgi
|