我有
class Foo < ActiveRecord::Base named_scope :a,lambda { |a| :conditions => { :a => a } } named_scope :b,lambda { |b| :conditions => { :b => b } } end
我想要
class Foo < ActiveRecord::Base named_scope :ab,lambda { |a,b| :conditions => { :a => a,:b => b } } end
但我宁愿以干燥的方式做这件事.我可以通过使用获得相同的效果
Foo.a(something).b(something_else)
但它并不是特别可爱.