我有一个适用于Heroku的Rails(4.1.0)应用程序。但是,在我的本地机器上,由于使用inet数据类型的设备表而我使用sqlite3进行测试,因此rake db:migrate失败。
我已经包含了postgres gem以及postgres_ext但仍然出现错误:
undefined method `inet' for #<ActiveRecord::ConnectionAdapters::Table:0x00000005fae9e8>/home/app/db/migrate/20141107192501_add_devise_to_users.rb:19:in `block in up'
答案 0 :(得分:2)
如果使用Postgres进行本地测试是可以接受的,只需设置正确的适配器即可。样本database.yml
:
common: &common
adapter: postgresql
encoding: utf8
template: template0 # Required for UTF8 encoding
username: <%= ENV["POSTGRES_USER"] %>
password: <%= ENV["POSTGRES_PASSWORD"] %>
host: <%= ENV["POSTGRES_HOST"] %>
development:
<<: *common
database: 'my_app_dev'
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
<<: *common
database: 'my_app_test'