Module: ActiveRecord::ConnectionAdapters::ColumnMethods
- Included in:
- PostgreSQLAdapter::Table, PostgreSQLAdapter::TableDefinition
- Defined in:
- lib/activerecord-postgres-postgis/active_record/connection_adapters/schema_definitions.rb
Instance Method Summary collapse
-
#geography(name, options = {}) ⇒ Object
Adds geography type for migrations.
-
#geometry(name, options = {}) ⇒ Object
Adds geometry type for migrations.
Instance Method Details
#geography(name, options = {}) ⇒ Object
Adds geography type for migrations. So you can add column to a table like:
create_table :locations do |t|
...
t.geography :geog, type: 'LINESTRING'
...
end
23 24 25 |
# File 'lib/activerecord-postgres-postgis/active_record/connection_adapters/schema_definitions.rb', line 23 def geography(name, = {}) column(name, :geography, ) end |
#geometry(name, options = {}) ⇒ Object
Adds geometry type for migrations. So you can add column to a table like:
create_table :locations do |t|
...
t.geometry :geom, srid: 423, type: 'LINESTRING'
...
end
11 12 13 |
# File 'lib/activerecord-postgres-postgis/active_record/connection_adapters/schema_definitions.rb', line 11 def geometry(name, = {}) column(name, :geometry, ) end |