How to solve the error ActiveRecord :: StatementInvalid: PG :: UndefinedTable in rails?

0

I'm developing an application in rails and the following error appears in my bank at the time I try to perform a rake db: migrate. I have tried to give a drop in the bank and a create in sequence, however the same error happens. The curious thing is that it was working normally and there was no change in the "products" module of the application.

  

ActiveRecord :: StatementInvalid: PG :: UndefinedTable: ERROR: "Products" relationship does not exist   LINE 5: WHERE a.attrelid = '"products"' :: regclass                                          ^   : SELECT a.attname, format_type (a.atttypid, a.atttypmod),                       pg_get_expr (d.adbin, d.adrelid), a.attnotnull, a.atttypid, > a.atttypmod                FROM pg_attribute to LEFT JOIN pg_attrdef d                  ON a.attrelid = d.adrelid AND a.attnum = d.adnum               WHERE a.attrelid = '"products"' :: regclass                 AND a.attnum > 0 AND NOT a.attisdropped               ORDER BY a.attnum

class CreateProducts < ActiveRecord::Migration
  def change
    create_table :products do |t|
      t.references :type
      t.string :mark
      t.string :model
      t.string :engine
      t.text :description
      t.string :barcode
      t.timestamps
    end
    add_index :products, :type_id
  end
end
    
asked by anonymous 18.06.2014 / 17:26

1 answer

1

Alex, I managed to find the problem. I'm testing Active Admin and I believe the relationship should be made in the admin tb interface. I commented on the interface I was editing and the migration was done. Problem solved. Thanks

    
27.06.2014 / 21:08