believer 0.2.11 → 0.2.13
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/believer/columns.rb +6 -0
- data/lib/believer/query.rb +9 -2
- data/lib/believer/version.rb +1 -1
- metadata +2 -2
data/lib/believer/columns.rb
CHANGED
@@ -124,6 +124,7 @@ module Believer
|
|
124
124
|
else
|
125
125
|
v = col.convert_to_type(v)
|
126
126
|
end
|
127
|
+
v = col.default_value if v.nil? && col.has_default_value?
|
127
128
|
end
|
128
129
|
@attributes[attr_name] = v
|
129
130
|
end
|
@@ -152,6 +153,11 @@ module Believer
|
|
152
153
|
end if attrs.present?
|
153
154
|
end
|
154
155
|
|
156
|
+
# Returns a hash of all the attributes with their names as keys and the values of the attributes as values.
|
157
|
+
def attributes_dup
|
158
|
+
@attributes.dup
|
159
|
+
end
|
160
|
+
|
155
161
|
#protected
|
156
162
|
def merge_attributes(attrs)
|
157
163
|
@attributes ||= {}
|
data/lib/believer/query.rb
CHANGED
@@ -32,10 +32,17 @@ module Believer
|
|
32
32
|
pluck_res = []
|
33
33
|
rows.each do |r|
|
34
34
|
if fields.size > 1
|
35
|
-
pluck_res << fields.map {|f|
|
35
|
+
pluck_res << fields.map {|f|
|
36
|
+
val = r[f.to_s]
|
37
|
+
col = record_class.columns[f]
|
38
|
+
val = (col.apply_cql_result_row_conversion? ? col.convert_to_type(val) : val)
|
39
|
+
val
|
40
|
+
}
|
36
41
|
else
|
37
42
|
f = fields[0]
|
38
|
-
|
43
|
+
val = r[f.to_s]
|
44
|
+
col = record_class.columns[f]
|
45
|
+
pluck_res << (col.apply_cql_result_row_conversion? ? col.convert_to_type(val) : val)
|
39
46
|
end
|
40
47
|
end
|
41
48
|
pluck_res
|
data/lib/believer/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: believer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.13
|
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-11-
|
12
|
+
date: 2013-11-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activemodel
|