我的应用程序执行用户可以投票和取消投票的“想法” 。 它在当地运作良好。 当被推到赫鲁库时,用户可以投票,但无票行动不起作用,产生一个“我们再次道歉,但有些事出错了”。
我检查了下层的日志,错误如下:
2012-05-25T09:47:18+00:00 app[web.1]: Started POST "/ideas/remove_vote/1/1" for 88.171.195.199 at 2012-05-25 09:47:18 +0000
2012-05-25T09:47:18+00:00 app[web.1]: Processing by IdeasController#remove_vote as HTML
2012-05-25T09:47:18+00:00 app[web.1]: Parameters: {"authenticity_token"=>"mJ5daJfBhf+823VTg9C1+YSBdqVFTFPuJWiO2cIx6iQ=", "u_id"=>"1", "i_id"=>"1"}
2012-05-25T09:47:18+00:00 app[web.1]: Completed 500 Internal Server Error in 8ms
2012-05-25T09:47:18+00:00 app[web.1]: : DELETE FROM "votes" WHERE "votes"."" = $1):
2012-05-25T09:47:18+00:00 app[web.1]: app/controllers/ideas_controller.rb:85:in `remove_vote
2012-05-25T09:47:18+00:00 app[web.1]:
2012-05-25T09:47:18+00:00 app[web.1]: ActiveRecord::StatementInvalid (PG::Error: ERROR: zero-length delimited identifier at or near """"
2012-05-25T09:47:18+00:00 app[web.1]: ^
2012-05-25T09:47:18+00:00 app[web.1]: LINE 1: DELETE FROM "votes" WHERE "votes"."" = $1
2012-05-25T09:47:18+00:00 app[web.1]:
2012-05-25T09:47:18+00:00 app[web.1]: cache: [POST /ideas/remove_vote/1/1] invalidate, pass
2012-05-25T09:47:18+00:00 app[web.1]:
我的remove_vote
方法在概念_controller.rb中如下:
def remove_vote
@vote = Vote.find_by_user_id_and_idea_id(params[:u_id], params[:i_id])
@vote.destroy
redirect_to ideas_path
end
你们中是否有人有办法解决这个问题?我怀疑这与本地数据库是SQLite(SQLite)和赫鲁库(Heroko)的制作是PostgreSQL(PostgreSQL)有关,但我感到奇怪的是,增加一票是有用的,删除一票不是。