“PG::UndefinedTable: ERROR: relation does not exist” with a correct Rails naming and convention

前端 未结 2 1753
生来不讨喜
生来不讨喜 2020-12-20 12:49

I\'ve read a lot of potsts like this, but all the solutions I\'ve seen are in the nomenclature of the models, naming and Rails convention.

Now I have this problem wh

相关标签:
2条回答
  • 2020-12-20 13:35

    I ran into my own error again !!, when executing rake test, but in this case thanks to cedricdlb I've found here the solution, quite simply:

    rake db:test:prepare
    rake db:test:load
    
    0 讨论(0)
  • 2020-12-20 13:36

    I have the same problem and I found that in my migrations I don't have table names in plural form:

    For example:

    
    
        class CreatePosts  ActiveRecord::Migration
          def change
            create_table :posts do |t|
              t.string :source
              t.string :destination
              t.datetime :time
              t.timestamps
            end
          end
        end
    
    
    

    I have create_table :post, but when I change it to create_table :posts. It start working!!!!

    0 讨论(0)
提交回复
热议问题