我正在将 Rails 应用程序表单 sqlite 转换为 postgres,以便我可以使用 heroku 进行部署。我安装了 postgres 并运行了迁移,但是当我尝试运行查询以查找与房屋关联的所有室友时,出现以下错误
PG::Error: ERROR: operator does not exist: character varying = integer
LINE 1: SELECT COUNT(*) FROM "mates" WHERE "mates"."house_id" = 1
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
: SELECT COUNT(*) FROM "mates" WHERE "mates"."house_id" = 1
此错误源于您在添加房屋后被重定向到创建和管理员的注册视图。这是查看代码:
Extracted source (around line #4):
1: <div class="container">
2: <div class="row">
3: <div class="span5 offset3">
4: <% if current_house.mates.empty? %>
5: <h2>Add an Administrator</h2>
6: <% else %>
7: <h2>Add a New Housemate</h2>
感谢所有的帮助!