关于find中的:conditions,如果跟多个属性的问题

关于find中的:conditions,如果跟多个属性的问题

比如我现在有句代码:
   Message.find(:all, :conditions => [ "deleted=?", 0])
  如果我还要跟个属性,type=1,怎么个写法?有人写过否?
Message.find(:all, :conditions => [ "deleted=?", “type”,0,1])
Message.find(:all, :conditions => [ "deleted=? and type='1'", 0])

如果你还想跟的话还可以继续啊
如:
Message.find(:all, :conditions => [ "deleted=? and type='1' and created_at between ? and ?", 0,start_time,end_time])
里面的问号会按顺序替换掉
引用:
原帖由 blackanger 于 2007-8-29 10:50 发表
Message.find(:all, :conditions => [ "deleted=?", “type”,0,1])
哈哈,一般酷吧
Message.find(:all, :conditions => [ "deleted=? and type=?", 0,1])
这样呢
这样能行吧!呵呵