Sha256: 582904ab532b3f9c972cb63a6d25e62e5cbd6462fd10962fd3d19a6b874f283f

Contents?: true

Size: 1.29 KB

Versions: 17

Compression:

Stored size: 1.29 KB

Contents

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

      PostgreSQL::Table.send(:include, ColumnMethods)
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
activerecord-postgis-adapter-5.0.2 lib/active_record/connection_adapters/postgis/column_methods.rb
activerecord-postgis-adapter-4.0.4 lib/active_record/connection_adapters/postgis/column_methods.rb
activerecord-postgis-adapter-5.0.1 lib/active_record/connection_adapters/postgis/column_methods.rb
activerecord-postgis-adapter-4.0.3 lib/active_record/connection_adapters/postgis/column_methods.rb
activerecord-postgis-adapter-3.1.5 lib/active_record/connection_adapters/postgis/column_methods.rb
activerecord-postgis-adapter-4.0.2 lib/active_record/connection_adapters/postgis/column_methods.rb
activerecord-postgis-adapter-4.0.0 lib/active_record/connection_adapters/postgis/column_methods.rb
activerecord-postgis-adapter-4.0.0.rc1 lib/active_record/connection_adapters/postgis/column_methods.rb
activerecord-postgis-adapter-4.0.0.beta4 lib/active_record/connection_adapters/postgis/column_methods.rb
activerecord-postgis-adapter-4.0.0.beta2 lib/active_record/connection_adapters/postgis/column_methods.rb
activerecord-postgis-adapter-4.0.0.beta1 lib/active_record/connection_adapters/postgis/column_methods.rb
activerecord-postgis-adapter-3.1.4 lib/active_record/connection_adapters/postgis/column_methods.rb
activerecord-postgis-adapter-3.1.3 lib/active_record/connection_adapters/postgis/column_methods.rb
activerecord-postgis-adapter-3.1.2 lib/active_record/connection_adapters/postgis/column_methods.rb
activerecord-postgis-adapter-3.1.1 lib/active_record/connection_adapters/postgis/column_methods.rb
activerecord-postgis-adapter-3.1.0 lib/active_record/connection_adapters/postgis/column_methods.rb
activerecord-postgis-adapter-3.0.0 lib/active_record/connection_adapters/postgis/column_methods.rb