webink 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/webink/database.rb +5 -2
- data/lib/webink/model.rb +3 -3
- metadata +2 -2
data/lib/webink/database.rb
CHANGED
@@ -181,9 +181,12 @@ module Ink
|
|
181
181
|
if @type == "mysql"
|
182
182
|
re = @db.method("query").call query
|
183
183
|
if re
|
184
|
-
re.
|
184
|
+
keys = re.fetch_fields.map(&:name)
|
185
|
+
re.each do |row|
|
185
186
|
result.push type.new
|
186
|
-
row.
|
187
|
+
row.each_index do |i|
|
188
|
+
k = keys[i]
|
189
|
+
v = row[i]
|
187
190
|
if v =~ /^[0-9]+$/
|
188
191
|
v = $&.to_i
|
189
192
|
elsif v =~ /^[0-9]+\.[0-9]+$/
|
data/lib/webink/model.rb
CHANGED
@@ -57,7 +57,7 @@ module Ink
|
|
57
57
|
# an Array of objects.
|
58
58
|
#
|
59
59
|
#
|
60
|
-
#
|
60
|
+
# == Fields and foreign sample config
|
61
61
|
#
|
62
62
|
# class Apple < Ink::Model
|
63
63
|
# def self.fields
|
@@ -309,8 +309,8 @@ module Ink
|
|
309
309
|
end
|
310
310
|
end
|
311
311
|
|
312
|
-
pkvalue = instance_variable_get "@#{self.class.primary_key
|
313
|
-
Ink::Database.database.remove self.class.name, "WHERE `#{self.class.primary_key
|
312
|
+
pkvalue = instance_variable_get "@#{self.class.primary_key}"
|
313
|
+
Ink::Database.database.remove self.class.name, "WHERE `#{self.class.primary_key}`=#{(pkvalue.is_a?(Numeric)) ? pkvalue : "\'#{pkvalue}\'"}"
|
314
314
|
end
|
315
315
|
|
316
316
|
# Instance method
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webink
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fcgi
|