Rails记录更新在本地工作但不在生产中

时间:2018-01-07 21:12:01

标签: ruby-on-rails heroku activerecord

为什么简单的更新可以在本地工作但是没有在heroku上生产的任何原因(repos是相同的,一切都是最新的)?在下面的日志中,我可以看到要更新的参数正在进入请求,但不知何故sql输出只更新更新于:

Video Update (3.1ms)  UPDATE "videos" SET "updated_at" = $1 WHERE "videos"."id" = $2  [["updated_at", "2018-01-07 20:54:51.465131"], ["id", 85]]

在开发中,完全相同的代码在开发服务器日志中生成:

Video Update (0.7ms)  UPDATE "videos" SET "imdb_id" = $1, "updated_at" = $2 WHERE "videos"."id" = $3  [["imdb_id", "566"], ["updated_at", "2018-01-07 20:09:28.366552"], ["id", 119]]

所以正在进行更新,但没有参数,即使参数已列入白名单并包含在请求日志中。我甚至不确定在这个问题中包含哪些信息或问题在哪里(rails,postgres,heroku)。

我的生产日志:

2018-01-07T20:54:51.408709+00:00 app[web.1]: I, [2018-01-07T20:54:51.408622 #4]  INFO -- : [6fad6a5f-021f-46ec-93a8-de53735f66f1] Processing by VideosController#update as HTML

2018-01-07T20:54:51.408843+00:00 app[web.1]: I, [2018-01-07T20:54:51.408752 #4]  INFO -- : [6fad6a5f-021f-46ec-93a8-de53735f66f1]   Parameters: {"utf8"=>"✓", "authenticity_token"=>"NJR5RNVHisPn1rDbglvmEIE80fk3pZjEfZ0YqOpXKGldRLR2JitrJrGf/syXfMaO8AiMtvo7N/EJqM/ToLkSLQ==", "file"=>"", "video"=>{"title"=>"Coco", "description"=>"", "imdb_id"=>"777", "public"=>"true"}, "commit"=>"Update", "id"=>"85"}

2018-01-07T20:54:51.445716+00:00 app[web.1]: D, [2018-01-07T20:54:51.445569 #4] DEBUG -- : [6fad6a5f-021f-46ec-93a8-de53735f66f1]   Video Load (7.6ms)  SELECT  "videos".* FROM "videos" WHERE "videos"."id" = $1 LIMIT $2  [["id", 85], ["LIMIT", 1]]

2018-01-07T20:54:51.448739+00:00 app[web.1]: D, [2018-01-07T20:54:51.448624 #4] DEBUG -- : [6fad6a5f-021f-46ec-93a8-de53735f66f1]   User Load (1.1ms)  SELECT  "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2  [["id", 7], ["LIMIT", 1]]

2018-01-07T20:54:51.451649+00:00 app[web.1]: D, [2018-01-07T20:54:51.451565 #4] DEBUG -- : [6fad6a5f-021f-46ec-93a8-de53735f66f1]    (0.9ms)  BEGIN

2018-01-07T20:54:51.459864+00:00 app[web.1]: D, [2018-01-07T20:54:51.459743 #4] DEBUG -- : [6fad6a5f-021f-46ec-93a8-de53735f66f1]   User Load (5.1ms)  SELECT  "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2  [["id", 7], ["LIMIT", 1]]

2018-01-07T20:54:51.485827+00:00 app[web.1]: D, [2018-01-07T20:54:51.485674 #4] DEBUG -- : [6fad6a5f-021f-46ec-93a8-de53735f66f1]   Video Update (3.1ms)  UPDATE "videos" SET "updated_at" = $1 WHERE "videos"."id" = $2  [["updated_at", "2018-01-07 20:54:51.465131"], ["id", 85]]

2018-01-07T20:54:51.490476+00:00 app[web.1]: D, [2018-01-07T20:54:51.490385 #4] DEBUG -- : [6fad6a5f-021f-46ec-93a8-de53735f66f1]    (2.4ms)  COMMIT

2018-01-07T20:54:51.491713+00:00 app[web.1]: I, [2018-01-07T20:54:51.491568 #4]  INFO -- : [6fad6a5f-021f-46ec-93a8-de53735f66f1] Redirected to https://www.browzable.com/library

1 个答案:

答案 0 :(得分:0)

重新启动Heroku后它工作了。也许在我迁移后它没有重新开始。