当我在Ubuntu上本地运行我的Rails应用程序时,它运行良好,但是一旦将其部署到herokuapp,它就会导致错误。
forw = Forward.select(:user_id).where(:doc_id => params[:id])
@users = User.where.not(:id => "#{@user.id}").where.not(:id => forw)
@sent = User.where.not(:id => "#{@user.id}").where(:id => forw)
# line 41 is below ↓
@status = Forward.select(:status).where(user_id: @sent.ids).where(doc_id: params[:id])
我认为这是错误所在?这是我的一个控制器中的查询。任何帮助将不胜感激。
这是我执行herokuapp时的heroku日志。
2018-07-12T10:06:51.973236+00:00 app[web.1]: I, [2018-07-12T10:06:51.973159 #4] INFO -- : [fb2eda7a-41f6-49a8-9383-29902a059f61] Completed 500 Internal Server Error in 8ms (ActiveRecord: 2.7ms)
2018-07-12T10:06:51.974312+00:00 app[web.1]: F, [2018-07-12T10:06:51.974236 #4] FATAL -- : [fb2eda7a-41f6-49a8-9383-29902a059f61]
2018-07-12T10:06:51.974419+00:00 app[web.1]: F, [2018-07-12T10:06:51.974348 #4] FATAL -- : [fb2eda7a-41f6-49a8-9383-29902a059f61] ActiveRecord::StatementInvalid (PG::UndefinedFunction: ERROR: operator does not exist: bigint = text
2018-07-12T10:06:51.974422+00:00 app[web.1]: LINE 1: ...sers" WHERE ("users"."id" != $1) AND "users"."id" IN (SELECT...
2018-07-12T10:06:51.974424+00:00 app[web.1]: ^
2018-07-12T10:06:51.974426+00:00 app[web.1]: HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
2018-07-12T10:06:51.974430+00:00 app[web.1]: : SELECT "users"."id" FROM "users" WHERE ("users"."id" != $1) AND "users"."id" IN (SELECT "forwards"."user_id" FROM "forwards" WHERE "forwards"."doc_id" = $2)):
2018-07-12T10:06:51.974525+00:00 app[web.1]: F, [2018-07-12T10:06:51.974459 #4] FATAL -- : [fb2eda7a-41f6-49a8-9383-29902a059f61]
2018-07-12T10:06:51.974631+00:00 app[web.1]: F, [2018-07-12T10:06:51.974567 #4] FATAL -- : [fb2eda7a-41f6-49a8-9383-29902a059f61] app/controllers/events_controller.rb:41:in `forward'
我的gemfile声明数据库
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
end