【发布时间】:2018-12-15 15:19:53
【问题描述】:
生产日志:
irb(main):036:0> People.find(7).update_attribute(:all_read,[2,3])
People Load (1.2ms) SELECT "people".* FROM "people" WHERE "people"."id" = $1 LIMIT 1 [["id", 7]]
People Load (1.2ms) SELECT "people".* FROM "people" WHERE "people"."id" = $1 LIMIT 1 [["id", 7]]
(0.7ms) BEGIN
(0.7ms) BEGIN
(0.7ms) COMMIT
(0.7ms) COMMIT
People Store (29.1ms) {"id":7}
People Store (29.1ms) {"id":7}
=> true
irb(main):037:0> People.find(7).all_read
People Load (1.0ms) SELECT "people".* FROM "people" WHERE "people"."id" = $1 LIMIT 1 [["id", 7]]
People Load (1.0ms) SELECT "people".* FROM "people" WHERE "people"."id" = $1 LIMIT 1 [["id", 7]]
=> []
这在本地工作得很好,但在 heroku 上不起作用。 我在本地使用 sqlite3,在 heroku 上使用 postgresql。
其他相关代码:
class People < ActiveRecord::Base
serialize :all_read, Array
schema.db
create_table "people", force: :cascade do |t|
...
t.string "all_read", default: "--- []\n"
end
【问题讨论】:
-
生产日志上有什么?
-
为什么要投反对票???
-
在没有提供建议的情况下投反对票是没有意义的。
标签: ruby-on-rails postgresql heroku