0
難道這是轉換爲使用符號和運算符的符號,而不是更好的可讀性:如何使用帶有符號和運算符的活動記錄查詢?
scope :visible, where("is_hidden = false")
scope :current, where("exp_date IS NULL OR exp_date > " + timestamp)
轉換弄成這個樣子:
scope :active, where( :is_hidden => false,
(:exp_date => nil || :exp_date > timestamp)
)
對不起,我搞砸了語法(我的品牌新的紅寶石)
檢查Squeel https://github.com/ernie/squeel – Bohdan
什麼是「構建狀態:失敗」在他們的GitHub是什麼意思?這是一個安全的寶石被利用? – Hopstream
Squeel很棒。如果您使用的是3.1之前的版本,並且遇到問題,您可以查看[meta_where](https://github.com/ernie/meta_where)...我相信相同的人/人。 – jaydel