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