我正在将对重复事件的支持添加到我的rails应用程序中。
其中一个功能是
recurring_event.delete_this_and_following
应用程序/模型/重复事件.rb
16 class RecurringEvent < ApplicationRecord
17 belongs_to :event
32 def delete_this_and_following
33 event.recurring_events.where("start_time >= ?", start_time).destroy_all
34 end
不幸的是,这给了我一个错误:
(byebug) event.recurring_events.where("start_time >= ?", start_time).size
*** ActiveRecord::StatementInvalid Exception: PG::InFailedSqlTransaction:
ERROR: current transaction is aborted, commands ignored until end
of transaction block
: SELECT COUNT(*) FROM "recurring_events"
WHERE "recurring_events"."event_id" = $1 AND
(start_time >= '2018-10-23 10:42:50.281315')
nil
开始日期格式错误吗?
start_time.to_s => "2018-10-23 11:24:59 UTC"