Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined method 'st_point' #174

Closed
h0lyalg0rithm opened this issue Apr 20, 2015 · 15 comments
Closed

Undefined method 'st_point' #174

h0lyalg0rithm opened this issue Apr 20, 2015 · 15 comments

Comments

@h0lyalg0rithm
Copy link

@h0lyalg0rithm h0lyalg0rithm commented Apr 20, 2015

Hi I am currently using the beta release of this gem and I came across this issue when running the migration.
I am using '3.0.0beta2'
Ruby 2.2
ActiveRecord 4.2

@sauy7

This comment has been minimized.

Copy link

@sauy7 sauy7 commented Apr 21, 2015

@h0lyalg0rithm looks like a misconfiguration somewhere in your app. Some things to check...

Are you sure the postgis extension has been created in the database (rake db:gis:setup)?

Is the postgis adapter specified in your database.yml file?

Does this gem appear in your Gemfile.lock?

@h0lyalg0rithm

This comment has been minimized.

Copy link
Author

@h0lyalg0rithm h0lyalg0rithm commented Apr 22, 2015

here is my database.yml file

default: &default
  adapter: postgis
  encoding: unicode
  schema_search_path: public, postgis

I have the beta version of the gem in my gemfile
gem 'activerecord-postgis-adapter', '3.0.0beta2'

@sauy7

This comment has been minimized.

Copy link

@sauy7 sauy7 commented Apr 22, 2015

Are you able to run an SQL command including postgis functions directly on your database?

For instance, what does the following return:

SELECT PostGIS_full_version();

Does your database include the spatial_ref_sys table?

@h0lyalg0rithm

This comment has been minimized.

Copy link
Author

@h0lyalg0rithm h0lyalg0rithm commented Apr 22, 2015

Yes the database contains the spatial_ref_sys table;

I was able to run postgis function.I guess there is some issue creating the schema file for the database.My current workaround is to manually specify the datatype in the schema file and then load it into the database.
In my case i set it as
t.geography "latlon", limit: {:srid=>4326, :type=>"point", :geographic=>true}

SELECT PostGIS_full_version(); gave me the following result

                                                                       postgis_full_version
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
 POSTGIS="2.1.7 r13414" GEOS="3.4.2-CAPI-1.8.2 r3921" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.11.2, released 2015/02/10" LIBXML="2.9.2" LIBJSON="UNKNOWN" RASTER
(1 row)
@sauy7

This comment has been minimized.

Copy link

@sauy7 sauy7 commented Apr 22, 2015

Personally, I'm using this in the migration file:

t.st_point :lonlat, srid: 4326, geographic: true

and in config/application:

config.active_record.schema_format = :sql

So I have a structure.sql file rather than schema.rb.

@h0lyalg0rithm

This comment has been minimized.

Copy link
Author

@h0lyalg0rithm h0lyalg0rithm commented Apr 23, 2015

It seems like the issue occurs only when you try to add the st_point migration to an existing model.
IF you add it to a create_table block there are no problems.
But if you add the code in the change_table block you get the following error

undefined method `st_point' for #<ActiveRecord::ConnectionAdapters::PostgreSQL::Table:0x007fd0a55177c8>/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/rgeo-activerecord-2.1.1/lib/rgeo/active_record/common_adapter_elements.rb:87:in `method_missing_with_rgeo'
/Users/surajshirvankar/Google Drive/Development/Apps/postgis/db/migrate/20150423200401_addpost.rb:4:in `block in change'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:351:in `change_table'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:662:in `block in method_missing'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:632:in `block in say_with_time'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:632:in `say_with_time'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:652:in `method_missing'
/Users/surajshirvankar/Google Drive/Development/Apps/postgis/db/migrate/20150423200401_addpost.rb:3:in `change'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:606:in `exec_migration'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:590:in `block (2 levels) in migrate'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:589:in `block in migrate'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:588:in `migrate'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:765:in `migrate'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:995:in `block in execute_migration_in_transaction'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:1041:in `block in ddl_transaction'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/transaction.rb:188:in `within_new_transaction'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/transactions.rb:220:in `transaction'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:1041:in `ddl_transaction'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:994:in `execute_migration_in_transaction'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:956:in `block in migrate'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:952:in `each'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:952:in `migrate'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:820:in `up'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:798:in `migrate'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/bin/ruby_executable_hooks:15:in `eval'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/bin/ruby_executable_hooks:15:in `<main>'
NoMethodError: undefined method `st_point' for #<ActiveRecord::ConnectionAdapters::PostgreSQL::Table:0x007fd0a55177c8>
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/rgeo-activerecord-2.1.1/lib/rgeo/active_record/common_adapter_elements.rb:87:in `method_missing_with_rgeo'
/Users/surajshirvankar/Google Drive/Development/Apps/postgis/db/migrate/20150423200401_addpost.rb:4:in `block in change'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:351:in `change_table'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:662:in `block in method_missing'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:632:in `block in say_with_time'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:632:in `say_with_time'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:652:in `method_missing'
/Users/surajshirvankar/Google Drive/Development/Apps/postgis/db/migrate/20150423200401_addpost.rb:3:in `change'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:606:in `exec_migration'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:590:in `block (2 levels) in migrate'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:589:in `block in migrate'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:588:in `migrate'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:765:in `migrate'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:995:in `block in execute_migration_in_transaction'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:1041:in `block in ddl_transaction'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/transaction.rb:188:in `within_new_transaction'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/transactions.rb:220:in `transaction'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:1041:in `ddl_transaction'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:994:in `execute_migration_in_transaction'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:956:in `block in migrate'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:952:in `each'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:952:in `migrate'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:820:in `up'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:798:in `migrate'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/bin/ruby_executable_hooks:15:in `eval'
/Users/surajshirvankar/.rvm/gems/ruby-2.2.0/bin/ruby_executable_hooks:15:in `<main>'
@teeparham

This comment has been minimized.

Copy link
Member

@teeparham teeparham commented Apr 23, 2015

You do not have to change the column if you are updating to the 3.0.0 adapter. You may need to run rake db:schema:dump to re-dump the schema file in the new format.

The column definition generated for the ruby schema file is (usually) different than what you specify in the migrations because there are several ways to define a column, and the "limit" options are need to import the column definition.

However, this is likely bug. We need a test for change_column.

@zaidakram

This comment has been minimized.

Copy link

@zaidakram zaidakram commented May 23, 2015

I second @h0lyalg0rithm on this. I'm facing the same issue. This issue occurs only when you try to add the st_point migration to an existing model.

undefined method `st_point' for #<ActiveRecord::ConnectionAdapters::PostgreSQL::Table:0x007fdf0c2c8268>/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/rgeo-activerecord-3.0.0/lib/rgeo/active_record/common_adapter_elements.rb:87:in `method_missing_with_rgeo'
/home/zaid/workspace/myproject/db/migrate/20150523084650_add_coordinates_to_property.rb:4:in `block in change'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:351:in `change_table'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/migration.rb:662:in `block in method_missing'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/migration.rb:632:in `block in say_with_time'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/migration.rb:632:in `say_with_time'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/migration.rb:652:in `method_missing'
/home/zaid/workspace/myproject/db/migrate/20150523084650_add_coordinates_to_property.rb:3:in `change'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/migration.rb:606:in `exec_migration'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/migration.rb:590:in `block (2 levels) in migrate'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/migration.rb:589:in `block in migrate'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/migration.rb:588:in `migrate'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/migration.rb:765:in `migrate'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/migration.rb:995:in `block in execute_migration_in_transaction'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/migration.rb:1041:in `block in ddl_transaction'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/transaction.rb:188:in `within_new_transaction'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/transactions.rb:220:in `transaction'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/migration.rb:1041:in `ddl_transaction'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/migration.rb:994:in `execute_migration_in_transaction'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/migration.rb:956:in `block in migrate'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/migration.rb:952:in `each'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/migration.rb:952:in `migrate'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/migration.rb:820:in `up'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/migration.rb:798:in `migrate'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `block in load'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
-e:1:in `<main>'
NoMethodError: undefined method `st_point' for #<ActiveRecord::ConnectionAdapters::PostgreSQL::Table:0x007fdf0c2c8268>
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/rgeo-activerecord-3.0.0/lib/rgeo/active_record/common_adapter_elements.rb:87:in `method_missing_with_rgeo'
/home/zaid/workspace/myproject/db/migrate/20150523084650_add_coordinates_to_property.rb:4:in `block in change'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:351:in `change_table'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/migration.rb:662:in `block in method_missing'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/migration.rb:632:in `block in say_with_time'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/migration.rb:632:in `say_with_time'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/migration.rb:652:in `method_missing'
/home/zaid/workspace/myproject/db/migrate/20150523084650_add_coordinates_to_property.rb:3:in `change'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/migration.rb:606:in `exec_migration'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/migration.rb:590:in `block (2 levels) in migrate'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/migration.rb:589:in `block in migrate'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/migration.rb:588:in `migrate'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/migration.rb:765:in `migrate'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/migration.rb:995:in `block in execute_migration_in_transaction'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/migration.rb:1041:in `block in ddl_transaction'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/transaction.rb:188:in `within_new_transaction'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/transactions.rb:220:in `transaction'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/migration.rb:1041:in `ddl_transaction'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/migration.rb:994:in `execute_migration_in_transaction'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/migration.rb:956:in `block in migrate'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/migration.rb:952:in `each'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/migration.rb:952:in `migrate'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/migration.rb:820:in `up'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/migration.rb:798:in `migrate'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activerecord-4.2.0/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `block in load'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
/home/zaid/.rvm/gems/ruby-2.2.0@mygemset/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
-e:1:in `<main>'
@MaxPleaner

This comment has been minimized.

Copy link

@MaxPleaner MaxPleaner commented Dec 30, 2016

Having this problem in my test environment only. It's working in development mode.

running bundle exec rake db:migrate RAILS_ENV=test -

undefined method `st_point' for
#<ActiveRecord::ConnectionAdapters::PostgreSQL::TableDefinition:0x0055cdd8f278e8>

update: I solved it by fixing my ENV["DATABASE_URL"], like others. I guess I was being stubborn and assuming it wasn't a problem, but it turns out it was

@jcquarto

This comment has been minimized.

Copy link

@jcquarto jcquarto commented Jan 28, 2017

How did you fix your DATABASE_URL ? It sounds simple enough but I'm not quite sure where you are fixing it.

Our own situation: everything works fine in development. When we push to production, on Heroku, we get the error this thread refers to. Note that in heroku's "postdeploy" stage, we do
bundle exec rails db:gis:setup
bundle exec rails db:migrate

@MaxPleaner

This comment has been minimized.

Copy link

@MaxPleaner MaxPleaner commented Jan 29, 2017

@jcquarto it was a matter of changing out postgres:// for postgis:// in the database url. On Heroku you don't set the url yourself so I don't think that's the right fix. Maybe check Heroku's articles about postgis; wish I could be of more help.

@h0lyalg0rithm

This comment has been minimized.

Copy link
Author

@h0lyalg0rithm h0lyalg0rithm commented Jan 30, 2017

@jcquarto I had the same issue, changed the uri from postgres to postgis

@pejrich

This comment has been minimized.

Copy link

@pejrich pejrich commented Feb 28, 2017

@h0lyalg0rithm How did you change the uri on heroku? It wont let me change it as an env var

@h0lyalg0rithm

This comment has been minimized.

Copy link
Author

@h0lyalg0rithm h0lyalg0rithm commented Mar 27, 2017

@pejrich You can change the uri in the settings of the dyno.Click on the reveal config vars and the change it the database url from postgres to postgis

@chrisfinne

This comment has been minimized.

Copy link

@chrisfinne chrisfinne commented Mar 28, 2017

For proper Heroku config, this article tells you to tweak your database.yml:
https://devcenter.heroku.com/articles/rails-database-connection-behavior

production:
  url: <%= ENV.fetch('DATABASE_URL', '').sub(/^postgres/, "postgis") %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
8 participants
You can’t perform that action at this time.