PG::UndefinedTable: ERROR: relation “carrinho” doe

2019-09-08 15:48发布

问题:

I'm using rails 4, ruby 2.3 and have a problem. How solve this error?

PG::UndefinedTable: ERROR: relation "carrinho" does not exist LINE 1: SELECT "carrinho".* FROM "carrinho" WHERE "carrinho"."id" I... ^ : SELECT "carrinho".* FROM "carrinho" WHERE "carrinho"."id" IS NULL LIMIT 1

My model is carrinho.rb My controller is carrinhos_controller.rb My views is carrinhos My migration is 20160204181641_create_carrinhos.rb

And in inflections have:

  inflect.plural "carrinhos", "carrinhos"
  inflect.plural "carrinho", "carrinhos"
  inflect.singular "carrinhos", "carrinho"
  inflect.singular "carrinho", "carrinho"
  inflect.irregular 'carrinho', 'carrinhos'

Make A week that I try to solve this problem. Please, help-me!!

回答1:

I solve this, I just chanced position of inflect.irregular "carrinho", "carrinhos" to the beginning, and worked! I didn't know that the order influences, but now I don't mistake more. I hope it helped all.