Sha256: a501acc8988d77f9b2d3b949e715068616e602a696966463a5a2db57b5de7556

Contents?: true

Size: 1.32 KB

Versions: 3

Compression:

Stored size: 1.32 KB

Contents

# frozen_string_literal: true

module ActiveRecord
  module ConnectionAdapters
    module PostGIS
      module ColumnMethods
        def spatial(name, options = {})
          raise "You must set a type. For example: 't.spatial type: :st_point'" unless options[:type]
          column(name, options[:type], options)
        end

        def geography(name, options = {})
          column(name, :geography, options)
        end

        def geometry(name, options = {})
          column(name, :geometry, options)
        end

        def geometry_collection(name, options = {})
          column(name, :geometry_collection, options)
        end

        def line_string(name, options = {})
          column(name, :line_string, options)
        end

        def multi_line_string(name, options = {})
          column(name, :multi_line_string, options)
        end

        def multi_point(name, options = {})
          column(name, :multi_point, options)
        end

        def multi_polygon(name, options = {})
          column(name, :multi_polygon, options)
        end

        def st_point(name, options = {})
          column(name, :st_point, options)
        end

        def st_polygon(name, options = {})
          column(name, :st_polygon, options)
        end
      end
    end

    PostgreSQL::Table.include PostGIS::ColumnMethods
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
activerecord-postgis-adapter-5.2.3 lib/active_record/connection_adapters/postgis/column_methods.rb
activerecord-postgis-adapter-6.0.0 lib/active_record/connection_adapters/postgis/column_methods.rb
activerecord-postgis-adapter-5.2.2 lib/active_record/connection_adapters/postgis/column_methods.rb