Sha256: d8e16d1b2169348e58dc341882fffc42c25a125479226f3dadf62c2a9aa28001

Contents?: true

Size: 383 Bytes

Versions: 2

Compression:

Stored size: 383 Bytes

Contents

module MySQLPoint::Quoting
  def quote(value)
    # ActiveRecord 5.0, 5.1
    if value.respond_to?(:to_wkt)
      "ST_GeomFromText(#{super(value.to_wkt)})"
    # ActiveRecord 5.2
    elsif value.respond_to?(:value_for_database) && value.value_for_database.respond_to?(:to_wkt)
      "ST_GeomFromText(#{super(value.value_for_database.to_wkt)})"
    else
      super
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mysql_point-1.0.4 lib/mysql_point/quoting.rb
mysql_point-1.0.3 lib/mysql_point/quoting.rb