views:

39

answers:

1

What is the rails activerecord syntax for select records with an empty field? For example, I want to find all the records that the middle_name field is empty (length of the string < 1) for a user database. Thanks!

A: 
User.find(:all, :conditions=>["middle_name is  ? or middle_name = ?", nil, ''])
Salil