# Records not being returned

**URL:** <https://www.ruby-forum.com/t/records-not-being-returned/96731>\
**Category:** Rails\
**Created:** [July 1, 2006, 4:52am UTC](https://www.ruby-forum.com/t/records-not-being-returned/96731 "2006-07-01T04:52:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![daborg69](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/d9b06d/32.png) [@daborg69](https://www.ruby-forum.com/u/daborg69)\
**Post date:** [July 1, 2006, 4:52am UTC](https://www.ruby-forum.com/t/records-not-being-returned/96731/1 "2006-07-01T04:52:15Z")

</div>

I have the following line of code in my controller’s action method:

@needs = Need.find(:all, :conditions =\> “fulfilled\_date = ‘null’”)

This returns no records to the view, but I am expecting one record.

The following line in MySQL will return the record I expect:

Select \* from needs where fulfilled\_date is null;

To test the code, I substituted :conditions =\> “id = ‘1’” and this did  
return a record. That was to test the general validity of the code.

So I tried changing ‘null’ to ‘’ and to ‘nil’ Nothing. Also tried  
changing = to is, which caused a syntax error. Not finding an explicit  
example in my books, I resorted to trying everything I could think of.  
Nothing worked, which brings me here.

Being new at this, I’m missing something (obviously). Was hoping someone  
might point out what that is (which is not obvious).

Any help is of course much appreciated.

---

<div class="post-metadata">

**Author:** ![daborg69](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/d9b06d/32.png) [@daborg69](https://www.ruby-forum.com/u/daborg69)\
**Post date:** [July 1, 2006, 5:02am UTC](https://www.ruby-forum.com/t/records-not-being-returned/96731/2 "2006-07-01T05:02:13Z")

</div>

On Jun 30, 2006, at 7:52 PM, Scott H. wrote:

> @needs = Need.find(:all, :conditions =\> “fulfilled\_date = ‘null’”)

@needs = Need.find(:all, :conditions =\> “fulfilled\_date IS NULL”)

-Ezra

---

<div class="post-metadata">

**Author:** ![daborg69](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/d9b06d/32.png) [@daborg69](https://www.ruby-forum.com/u/daborg69)\
**Post date:** [July 1, 2006, 10:45am UTC](https://www.ruby-forum.com/t/records-not-being-returned/96731/3 "2006-07-01T10:45:21Z")

</div>

Ezra Z. wrote:

> On Jun 30, 2006, at 7:52 PM, Scott H. wrote:
> 
> > @needs = Need.find(:all, :conditions =\> “fulfilled\_date = ‘null’”)
> 
> @needs = Need.find(:all, :conditions =\> “fulfilled\_date IS NULL”)
> 
> -Ezra

Thank you Ezra. Yes, this worked! It did occur to me just this morning  
before checking back here at the forum, that the single quotes around  
null should not be, but I still didn’t have it right.

Very much appreciated.

Scott
