class SomeModel < ActiveRecord::Base
named_scope :recent, lambda { { :conditions => ['created_at > ?', 1.week.ago] } }
end
我想扩展 AR::Base 类以使所有模型都有这个 named_scope,我该怎么做?
class SomeModel < ActiveRecord::Base
named_scope :recent, lambda { { :conditions => ['created_at > ?', 1.week.ago] } }
end
我想扩展 AR::Base 类以使所有模型都有这个 named_scope,我该怎么做?