相关疑难解决方法(0)

Heroku Postgres错误:PGError:错误:关系"组织"不存在(ActiveRecord :: StatementInvalid)

我在将我的Rails应用程序部署到Heroku时遇到问题,在尝试访问应用程序时会抛出此错误:

PGError:错误:关系"组织"不存在(ActiveRecord :: StatementInvalid)

SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull
FROM pg_attribute a LEFT JOIN pg_attrdef d
  ON a.attrelid = d.adrelid AND a.attnum = d.adnum
WHERE a.attrelid = '"organizations"'::regclass
  AND a.attnum > 0 AND NOT a.attisdropped
ORDER BY a.attnum
Run Code Online (Sandbox Code Playgroud)

有人有什么想法吗?这对我来说是第一次,特别是因为我已经在其他应用程序上使用Heroku一年了,并且没有看到这样的东西.当然,一切都适用于本地SQLite.

postgresql ruby-on-rails heroku rails-activerecord

43
推荐指数
4
解决办法
3万
查看次数

rspec返回"PG ::错误:错误:关系"table_name"不存在"

环境是REE(2011.12),rvm,rspec 2.8.0,rails 3.0.6和pg 0.13.2.在CentOS 5.6上使用PostgreSQL 8.3.17.db:migrate可以正常工作.但是rspec有以下错误.

1) ApiController articles OK
 Failure/Error: Unable to find matching line from backtrace
 ActiveRecord::StatementInvalid:
   PG::Error: ERROR:  relation "table_name" does not exist
   : DELETE FROM "table_name"
Run Code Online (Sandbox Code Playgroud)

我正在使用rspec 1.x系列将我的项目从rails 2.3.5更新为使用rspec2的rails 3.0.复制了所有的rspec测试,我合并了旧的spec_helper.rb和新的(生成它rails g rspec:install).

ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'

Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}

RSpec.configure do |config|

  config.fixture_path = "#{::Rails.root}/spec/fixtures"
  config.use_transactional_fixtures = true

end
Run Code Online (Sandbox Code Playgroud)

我读到了关于这个错误的类似问题.所以我试过rake db:test:prepare或者rake db:test:load,但它没有解决.你有什么主意吗?看起来测试没有在测试数据库上运行......我该怎么办?:(

postgresql rspec rspec2 ruby-on-rails-3 rails-postgresql

11
推荐指数
1
解决办法
9505
查看次数