【发布时间】:2014-03-02 05:55:17
【问题描述】:
只是尝试在 ubuntu 上设置 rails 应用程序来做一些低级别的开发工作,而无需麻烦我们的主要开发人员。然而,在这个过程的最后,我运行 rails s 命令。我在 localhost:3000 上获得登录页面,无需直接调用数据库即可浏览这些页面。但是,当我转到从 db 获取数据的任何页面时,它会给我以下错误:
ActiveRecord::StatementInvalid in WantsController#new
PG::Error: ERROR: relation "geometry_columns" does not exist
LINE 1: SELECT * FROM geometry_columns WHERE f_table_name='wants'
^
: SELECT * FROM geometry_columns WHERE f_table_name='wants'
现在,不知道我做错了什么。以下是我正在采取的步骤:
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" >> /etc/apt/sources.list'
wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-9.3-postgis pgadmin3 postgresql-contrib postgresql-server-dev-9.3
sudo -u postgres psql
postgres=# CREATE EXTENSION adminpack;
postgres=# CREATE EXTENSION postgis;
postgres=# \q
postgres=# CREATE USER abc WITH PASSWORD 'abc';
postgres=# CREATE DATABASE abc;
postgres=# CREATE DATABASE abc_development;
pg_restore --verbose --clean --no-acl --no-owner -h localhost -U abc -d abc abc-20131217-09.pgdmp
pg_restore --verbose --clean --no-acl --no-owner -h localhost -U abc -d abc_development abc_development-20131217-09.pgdmp
然后导航到克隆的 git 文件夹并执行 bundle 和 rails s
这是database.yml:
development: &dev
# adapter: postgresql
database: abc_development
username: abc
password: abc
host: localhost
encoding: utf8
postgis_extension: true
schema_search_path: public,postgis
adapter: postgis
encoding: utf8
postgis_extension: postgis
production:
adapter: postgis
database: abc
username: abc
password: oTSZ1gQdwsFXWIUZsehj
host: localhost
encoding: utf8
postgis_extension: true
schema_search_path: public,postgis
postgis_extension: postgis
任何想法哪里出错了?非常感谢您的帮助。
【问题讨论】:
标签: ruby-on-rails ruby git postgresql ubuntu