我有以下where子句:字符串轉換爲在數量where子句
OnlineCourseRegistration.where(course_class_id: 6, status: "Completed")
=> #<OnlineCourseRegistration id: 142, cart_id: 150, user_id: 7069, course_class_id: 681, created_at: "2017-07-15 22:06:06", updated_at: "2017-07-20 23:59:01", exam_attempts: 1, exam_completed_at: "2017-07-20 23:57:32", evaluation_completed_at: "2017-07-20 23:59:01", status: "Completed", score: "87", add_extension: false, retest_cart_id: nil, retest_purchased_at: nil>
我還想補充一點,比分會是大於70,所以像...
OnlineCourseRegistration.where(course_class_id: 681, status: "Completed", :score.to_i > 70).last
...但當然,這是行不通的。在where子句中有沒有辦法做到這一點?
https://apidock.com/rails/ActiveRec ord/QueryMethods /其中 – krishnar