activerecord-mysql2rgeo-adapter 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9db157d9de22cd8f9f841f41e80d91c3721cf656
4
- data.tar.gz: 28e27dff6926e8ee812dccbc0446ae704b289abb
3
+ metadata.gz: 2ae61ad75e0c3b01f1fcb7b01a1646c415126fbe
4
+ data.tar.gz: f61144159cbcc55ade3b14bf0d52b7f843571ea4
5
5
  SHA512:
6
- metadata.gz: fd946b2d8f998030b2e0478b6df556509e7a727f93fd3086d3151d3eb2ddfdd64ba558fe6852e210029aa8ed0a409821280b86d602383e549951a5e5f5e16522
7
- data.tar.gz: '09a2ad7169d0051e7a749781a2c1f43846396f5dfcd66cc46b86b4cffcbeea8fb1687db71d34b818748d79b53145a79b1a1fe334253303685244e518a8ee6368'
6
+ metadata.gz: 166a724c80d6d2c7ff032fec44a0954a9f463b673c6c36611b9b42c9532920d8e37ac004a7fe65730eef98445d9433bea12331be90654242e622148caa8fe879
7
+ data.tar.gz: 45b5b5326a89185c8554ad234881188173ded6e01c9e8511dc82b4931583bbe27ccd0ef69b28fac7ef2f2d76dd4ff41bf678abea55ad1e1eb9ec77b439d3dffe
@@ -0,0 +1,18 @@
1
+ module RGeo
2
+ module ActiveRecord
3
+ module Mysql2Rgeo
4
+ module SpatialExpressions
5
+ def st_distance_sphere(rhs, units = nil)
6
+ args = [self, rhs]
7
+ args << units.to_s if units
8
+ SpatialNamedFunction.new("ST_Distance_Sphere", args, [false, true, true, false])
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
14
+
15
+ # Allow chaining of spatial expressions from attributes
16
+ Arel::Attribute.send :include, RGeo::ActiveRecord::Mysql2Rgeo::SpatialExpressions
17
+ RGeo::ActiveRecord::SpatialConstantNode.send :include, RGeo::ActiveRecord::Mysql2Rgeo::SpatialExpressions
18
+ RGeo::ActiveRecord::SpatialNamedFunction.send :include, RGeo::ActiveRecord::Mysql2Rgeo::SpatialExpressions
@@ -1,7 +1,7 @@
1
1
  module ActiveRecord
2
2
  module ConnectionAdapters
3
3
  module Mysql2Rgeo
4
- VERSION = "1.0.3".freeze
4
+ VERSION = "1.0.4".freeze
5
5
  end
6
6
  end
7
7
  end
@@ -10,6 +10,7 @@ require "active_record/connection_adapters/mysql2rgeo/column_methods"
10
10
  require "active_record/connection_adapters/mysql2rgeo/schema_statements"
11
11
  require "active_record/connection_adapters/mysql2rgeo/spatial_table_definition"
12
12
  require "active_record/connection_adapters/mysql2rgeo/spatial_column"
13
+ require "active_record/connection_adapters/mysql2rgeo/spatial_expressions"
13
14
  require "arel/visitors/bind_visitor"
14
15
  require "active_record/connection_adapters/mysql2rgeo/arel_tosql"
15
16
  require "active_record/type/spatial"
@@ -55,6 +56,10 @@ module ActiveRecord
55
56
  DEFAULT_SRID
56
57
  end
57
58
 
59
+ def supports_spatial?
60
+ !mariadb? && version >= '5.7.6'
61
+ end
62
+
58
63
  # Returns an array of indexes for the given table.
59
64
  def indexes(table_name, _name = nil) #:nodoc:
60
65
  indexes = []
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-mysql2rgeo-adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yongdae Hwang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-14 00:00:00.000000000 Z
11
+ date: 2017-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -108,6 +108,7 @@ files:
108
108
  - lib/active_record/connection_adapters/mysql2rgeo/create_connection.rb
109
109
  - lib/active_record/connection_adapters/mysql2rgeo/schema_statements.rb
110
110
  - lib/active_record/connection_adapters/mysql2rgeo/spatial_column.rb
111
+ - lib/active_record/connection_adapters/mysql2rgeo/spatial_expressions.rb
111
112
  - lib/active_record/connection_adapters/mysql2rgeo/spatial_table_definition.rb
112
113
  - lib/active_record/connection_adapters/mysql2rgeo/version.rb
113
114
  - lib/active_record/connection_adapters/mysql2rgeo_adapter.rb