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

前端 未结 2 1809
生来不讨喜
生来不讨喜 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: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!!!!

提交回复
热议问题