ActiveRecord :: StatementInvalid:PG ::错误:错误:关系“accountattributes”不存在

时间:2014-04-02 01:45:18

标签: ruby-on-rails postgresql activerecord relational-database

大家好,我有acvtive record rails 3.2和ruby 2.0

的问题

这里是我项目的示例代码

=============================================== =======================

test "to_csv_header should be available" do
    header_cells = CSV.parse(AccountAttribute.to_csv_header)[0]
    header_correct =
      ["#",
       _('AccountAttribute|Created at'),
       "#{_('AccountAttribute|Sex')} (#{_('description of AccountAttribute|Sex')})",
       _('AccountAttribute|Birthday')]
    assert_equal(header_correct, header_cells)
  end

  test "to_csv should be available" do
    aa = AccountAttribute.first
    assert_not_nil aa
    cells = CSV.parse(aa.to_csv)[0]
    assert_equal(AccountAttribute.csv_num_cols, cells.size)
  end

=============================================== =======================

当我在rails 3.0.2和ruby 1.9.3中运行测试时。测试成功通过,但是当我升级到rails 3.2和ruby 2.0时。它有如下错误:

=============================================== =======================

  

错误:test_to_csv_should_be_available(AccountAttributeTest)
  ActiveRecord :: StatementInvalid:PG ::错误:错误:关系   " accountattributes"不存在第5行:在哪里   a.attrelid ='" accountattributes"' :: regcl ...                                             ^:选择a.attname,format_type(a.atttypid,a.atttypmod),                          pg_get_expr(d.adbin,d.adrelid),a.attnotnull,a.atttypid,a.atttypmod                   从pg_attribute到LEFT JOIN pg_attrdef d                     在a.attrelid = d.adrelid和a.attnum = d.adnum                  在哪里a.attrelid ='" accountattributes"' :: regclass                    和a.attnum> 0而不是a.attisdropped                  ORDER BY a.attnum test / unit / account_attribute_test.rb:20:在`block in   '

=============================================== =======================

对这些人有任何想法,如果你这样做,请告诉我。 谢谢。 CMIIW

0 个答案:

没有答案