English 中文(简体)
罗罗投票系统在当地运作,但部署在赫罗库时不能使用
原标题:RoR Voting system working locally but not when deployed on Heroku

我的应用程序执行用户可以投票和取消投票的“想法” 。 它在当地运作良好。 当被推到赫鲁库时,用户可以投票,但无票行动不起作用,产生一个“我们再次道歉,但有些事出错了”。

我检查了下层的日志,错误如下:

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)有关,但我感到奇怪的是,增加一票是有用的,删除一票不是。

最佳回答

查看日志中正在印发的删除语句 : DELETE from "votes" where "votes"." = 1美元

是什么栏目?该栏目是哪栏?该栏目是哪栏?投票模式中是否有任何解释没有使用ID栏?

问题回答

当您遇到这样的问题时, 使用 postergres 在本地配置/ 运行您的应用程序是一个好主意。 这将允许您在本地调试这些问题, 而不是试图猜测赫鲁库的问题是什么 。

这是一个很好的轨道播报 获得后盖尔 在当地运行。

http://railscasts.com/episods/342-migrating-to-posgresql" rel=“no follow'>http://railscasts.com/episods/342-migrating-to-posgresql





相关问题
摘录数据

我如何将Excel板的数据输入我的Django应用? I m将PosgreSQL数据库作为数据库。

Postgres dump of only parts of tables for a dev snapshot

On production our database is a few hundred gigabytes in size. For development and testing, we need to create snapshots of this database that are functionally equivalent, but which are only 10 or 20 ...

How to join attributes in sql select statement?

I want to join few attributes in select statement as one for example select id, (name + + surname + + age) as info from users this doesn t work, how to do it? I m using postgreSQL.

What text encoding to use?

I need to setup my PostgreSQL DB s text encoding to handle non-American English characters that you d find showing up in languages such as German, Spanish, and French. What character encoding should ...

SQL LIKE condition to check for integer?

I am using a set of SQL LIKE conditions to go through the alphabet and list all items beginning with the appropriate letter, e.g. to get all books where the title starts with the letter "A": SELECT * ...

热门标签