Topic: Want to include Null values in the Search

I want to include rows in my search results which have requirement  = NULL

def search
       conditions = Req.conditions(*params.values_at(:requirement, :title))
    order = params[:order] || "id DESC"
       @title = "Search Results"
     @req_pages, @reqs = paginate(:reqs, :conditions => conditions, :order => order, :per_page => 10)
     @total = @req_pages.item_count
     render :layout => false if request.xml_http_request?
  end

Re: Want to include Null values in the Search

You need to do 'IS NULL' instead of '= NULL' in an SQL query.

Railscasts - Free Ruby on Rails Screencasts

Re: Want to include Null values in the Search

I meant how to do it in the method. SQL query in mysql gives the results.

Re: Want to include Null values in the Search

I'm not sure, can you post your Req.conditions methods?

Railscasts - Free Ruby on Rails Screencasts