The following code does not do what I need it to do. I would like to return a random design object whose user_id is not 1. As is, the query sometimes return no record.
offset = rand(Design.count)
@design = Design.first(:offset => offset, :conditions => [ "user_id != ?", 1])
What you’ll want to do is count the number of elements that also match those conditions: