尝试
attr_accessible :supplier_id, :supplier_type
validates :supplier_type, :presence => true,
:if => lambda{ check_supplier_exists }
def check_supplier_exists
@supplier = Supplier.find(self.supplier_id)
if @supplier != nil
return true
else
return false
end
end