<p>I want to find records on a combination of created_on >= some date AND name IN some list of names.</p>

<p>For ">=" I'd have to use sql condition. For "IN" I'd have to use a hash of conditions where the key is :name and the value is the array of names.</p>

<p>Is there a way to combine the two?</p>

You can use named scopes in rails 2.1 and above
```
```
Class Test < ActiveRecord::Base
  named_scope :created_after_2005, :conditions => "created_on > 2005-01-01"
  named_scope :named_fred, :conditions => { :name => "fred"}
end
```
```
then you can do
```
```
Test.created_after_2005.named_fred
```
```
Or you can give named_scope a lambda allowing you to pass in arguments
```
```
Class Test < ActiveRecord::Base
  named_scope :created_after, lambda { |date| {:conditions => ["created_on > ?", date]} }
  named_scope :named, lambda { |name| {:conditions => {:name => name}} }
end
```
```
then you can do
```
```
Test.created_after(Time.now-1.year).named("fred")
```
```