views:

23

answers:

1

hi,

i want to fetch other than collect value

i used below code

@boys = People.find(:all,:conditions => ["id != ?", @boy_id],:order => "created_at DESC")

where, @boy_id is collection of ids

but its not fetching the values

when i use IN(?) it fetches id in collection...

i want to fetch id values which are not in collection.. please suggest contrary to IN(?)

+1  A: 

Have you tried

@boys = People.find(:all, :conditions => ["id NOT IN (?)", @boy_id], :order => "created_at DESC")
Sidane