class ActiveRecord::ConnectionAdapters::PostgreSQLTable

Public Instance Methods

geography(column_name, opts = {}) click to toggle source
# File lib/active_record/postgresql_extensions/geometry.rb, line 354
def geography(column_name, opts = {})
  opts = {
    :srid => ActiveRecord::PostgreSQLExtensions::PostGIS.UNKNOWN_SRIDS[:geography]
  }.merge(opts)

  self.spatial(column_name, opts.merge(
    :spatial_column_type => :geography
  ))
end
geometry(column_name, opts = {})
Alias for: spatial
post_processing() click to toggle source

Add statements to execute to after a table has been created.

# File lib/active_record/postgresql_extensions/tables.rb, line 405
def post_processing
  @post_processing ||= []
end
spatial(column_name, opts = {}) click to toggle source
# File lib/active_record/postgresql_extensions/geometry.rb, line 340
def spatial(column_name, opts = {})
  column = PostgreSQLGeometryColumnDefinition.new(@base, column_name, opts)

  post_processing.concat(column.geometry_columns_entry(@table_name))
  post_processing.concat(column.geometry_column_index(@table_name))

  @base.add_column(@table_name, column_name, column.sql_type, opts)

  column.table_constraints.each do |constraint|
    @base.add_constraint(@table_name, constraint)
  end
end
Also aliased as: geometry

Private Instance Methods

table_constraints() click to toggle source
# File lib/active_record/postgresql_extensions/tables.rb, line 410
def table_constraints
  @table_constraints ||= []
end