0
我們在rails 3.0中使用的一些非常方便的範圍是可重用性。讓我們看一個例子。rails 3.1中的範圍關聯
class Wheel < AR::B
belongs_to :car
scope :deflated, where (:deflated => true)
end
class Car < AR::B
has_many :wheels
scope :out_of_service, joins(:wheels) & Wheel.deflated
end
但它似乎沒有在3.1中工作,你知道是否有一種新的方式來做到這一點? 謝謝