PGError語法問題,我有以下named_scope這在MySQL的正常工作和SQLite,但炸彈在Postgres的:爲named_scope
course.rb
named_scope :current, :conditions => ['start < ? AND end > ? ', Time.now, Time.now], :order => 'start ASC'
然後我就叫:
Course.current
我得到的錯誤:
PGError: ERROR: syntax error at or near "end" LINE 1: ... WHERE (start < '2010-03-17 14:03:24.995746' AND end > '201... ^: SELECT count(*) AS count_all FROM "courses" WHERE (start < '2010-03-17 14:03:24.995746' AND end > '2010-03-17 14:03:24.995748')
我的谷歌福是失敗的,所以我希望堆棧溢出不會。關於如何使該範圍成爲Postgres友好的任何想法?謝謝,
德魯
這就是它!我將該列從「結束」重新命名爲「完成」,現在我們已經完成了設置。非常感謝你的幫助! – 2010-03-18 17:36:31