That is all you need, when using ActiveRecord:

.where("field_in_db <> ''")