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: 0ba35fb4d432a8cf1fb8694d0bcf0aac9edaab76
4
- data.tar.gz: 8d967d3d61ac94226b60fb9717ba0c352eb8a6ab
3
+ metadata.gz: 66dddf290368d53788206a3e5868ae7287014900
4
+ data.tar.gz: e178568b38b251f6ca37304eaae26c6a17e65810
5
5
  SHA512:
6
- metadata.gz: 56cdcb1fb3d8b0f6a67d9e87acabe29410211c1e7f52ef68f07c1ed475973320c8555aa3e9e8cd660f871c919c4d5aed4ff23e5539fc7d65e76deccd8c21882f
7
- data.tar.gz: b92849cfa5425d38689db97e995682e655ae32397d5787959bfce92a7158e8eff99405fc036d94e8488072e45a356c3c71b8253348ddd03d39f3371d495e9eec
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("'(#{cube.to_a.map(&method(:Float)).join(",")})'")
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 Thing.type_for_attribute(column_name.to_s).type == :cube
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
 
@@ -1,3 +1,3 @@
1
1
  module ActiveRecordPostgreSQLCube
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
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.1
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-17 00:00:00.000000000 Z
11
+ date: 2016-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord