PG :: InvalidDatetimeFormat:错误:类型为timestamp的无效输入语法 - rails 4

时间:2017-02-11 15:08:01

标签: ruby-on-rails

  

我的以下范围在SQLite中运行得非常好,但在Postgres中我得到了   以下错误。我不确定如何以PG格式纠正这个问题。可以   一个人建议我。

错误:

PG::InvalidDatetimeFormat: ERROR:  invalid input syntax for type timestamp: "f"
2017-02-11T14:49:28.867872+00:00 app[web.1]: LINE 1: ..."."user_id" = $1 AND (subscription_payment_date = 'f' OR sub...
2017-02-11T14:49:28.867873+00:00 app[web.1]:                                                              ^
2017-02-11T14:49:28.867874+00:00 app[web.1]: : SELECT "payments".* FROM "payments" WHERE "payments"."user_id" = $1 AND (subscription_payment_date = 'f' OR subscription_payment_date IS NULL) AND (status = 'success')  ORDER BY created_at desc

payment.rb

scope :valid_payments, -> {where(['subscription_payment_date = ? OR subscription_payment_date IS ?', false, nil])}

模式:

  create_table "payments", force: :cascade do |t|
    t.string   "email"
    t.integer  "user_id"
    t.integer  "subscription_id"
    t.string   "stripe_payment_id"
    t.datetime "subscription_payment_date"
    t.string   "status"
  end

0 个答案:

没有答案