module ActiveRecord::ConnectionAdapters::PostGIS::ColumnDefinitionUtils
Public Class Methods
default_srid(options)
click to toggle source
# File lib/active_record/connection_adapters/postgis/spatial_table_definition.rb, line 53 def default_srid(options) options[:geographic] ? 4326 : PostGISAdapter::DEFAULT_SRID end
geo_type(type = "GEOMETRY")
click to toggle source
# File lib/active_record/connection_adapters/postgis/spatial_table_definition.rb, line 38 def geo_type(type = "GEOMETRY") g_type = type.to_s.delete("_").upcase return "POINT" if g_type == "STPOINT" return "POLYGON" if g_type == "STPOLYGON" g_type end
limit_from_options(type, options = {})
click to toggle source
# File lib/active_record/connection_adapters/postgis/spatial_table_definition.rb, line 45 def limit_from_options(type, options = {}) has_z = options[:has_z] ? 'Z' : '' has_m = options[:has_m] ? 'M' : '' srid = options[:srid] || default_srid(options) field_type = [geo_type(type), has_z, has_m].compact.join "#{field_type},#{srid}" end