activerecord-postgresql-cube 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66dddf290368d53788206a3e5868ae7287014900
|
4
|
+
data.tar.gz: e178568b38b251f6ca37304eaae26c6a17e65810
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02bddb9e62e07f5d1c2436013c55821b0dd8404d189c96f2db3606576d8a90c3136fd1308c5bf8ff7399e0b92d083e77fa952be1af074747837dea93a7236227
|
7
|
+
data.tar.gz: 6ca115dbc710f3f75414cc0698462701edcc0847ec59800167557f5e6b67c515aaa8a89921f8f8d06a39d5b519fa9b84810e53612e0734e1921993d0ba33f60a
|
@@ -7,7 +7,7 @@ module ActiveRecordPostgreSQLCube
|
|
7
7
|
class_methods do
|
8
8
|
def by_cube_distance(column_name, cube)
|
9
9
|
column = arel_table[column_name]
|
10
|
-
cube_values = Arel.sql("'
|
10
|
+
cube_values = Arel.sql("'#{ActiveRecord::Type.lookup(:cube).serialize(cube)}'")
|
11
11
|
distance_operation = Arel::Nodes::InfixOperation.new("<->", column, cube_values)
|
12
12
|
distance_column_name = %{"#{column_name}_distance"}
|
13
13
|
distance = Arel::Nodes::As.new(distance_operation, Arel.sql(distance_column_name))
|
@@ -16,7 +16,7 @@ module ActiveRecordPostgreSQLCube
|
|
16
16
|
end
|
17
17
|
|
18
18
|
private def cube_attributes(column_name, *attributes)
|
19
|
-
unless
|
19
|
+
unless type_for_attribute(column_name.to_s).type == :cube
|
20
20
|
raise ArgumentError, "#{column_name} is not a cube column"
|
21
21
|
end
|
22
22
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-postgresql-cube
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Milo Winningham
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|