【发布时间】:2010-09-17 10:29:31
【问题描述】:
我有一个模型:
class Shirt < ActiveRecord::Base
named_scope :red, :conditions => { :color => 'red' }
named_scope :blue, :conditions => { :color => 'blue' }
named_scope :xl, :conditions => { :size => 'xl' }
end
我忘了,如何轻松地将命名范围添加到现有的匿名范围:
scope = Shirt.scoped({})
#and how to add ie. :red to scope?
【问题讨论】:
标签: ruby-on-rails activerecord named-scope