0
这工作在Rails的控制台的工作原理:Hstore阵列属性不会代码更新,但在控制台
pry(main)> calendar.update({"open_times"=>[{"start"=>"1111-11-11T00:30:00.000Z", "end"=>"1111-11-11T04:00:00.000Z", "title"=>" "}]})
(0.3ms) SAVEPOINT active_record_1
(0.2ms) RELEASE SAVEPOINT active_record_1
=> true
但相同的更新方法不起作用其他地方(模型,控制器等) 。返回的错误是TypeError: can't cast Array to
。它甚至没有说我不能阵列(但我假设hstore)。
这里是我的列迁移:
def change
enable_extension 'hstore'
add_column :calendars, :open_times, :hstore, array: true, default: [], null: false
end
的思考?
检查PostgreSQL错误日志中Rails运行的语句和完整错误。 – 2015-04-01 05:34:26