class Game < Event
has_many :statistics, :dependent => :destroy
...
end
class Statistic < ActiveRecord::Base
belongs_to :game
end
我想创建一个只返回没有统计信息的游戏的命名范围。
由于
答案 0 :(得分:2)
尝试
named_scope :no_statistics, :include => :statistics, :conditions => ['statistics.id IS NULL']