# Check if the there is no records found

**URL:** <https://www.ruby-forum.com/t/check-if-the-there-is-no-records-found/188050>\
**Category:** Rails\
**Created:** [May 4, 2010, 11:17pm UTC](https://www.ruby-forum.com/t/check-if-the-there-is-no-records-found/188050 "2010-05-04T23:17:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mohammed\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/bcef8e/32.png) [@mohammed\_a](https://www.ruby-forum.com/u/mohammed_a)\
**Post date:** [May 4, 2010, 11:17pm UTC](https://www.ruby-forum.com/t/check-if-the-there-is-no-records-found/188050/1 "2010-05-04T23:17:39Z")

</div>

In the controller  
@properties = Property.paginate :page =\> params[:page], :order =\>  
‘created\_at DESC’

in the view  
I have tried  
\<% if !$properties.blank? %\>  
\<%= render :partial =\> “show\_properties\_list” %\>  
\<%else%\>

### no records found
\<%end%\> but it did not work also, I have tried empty? and not [] {}

all of them did not work

could someone tell me what I am doing wrong

---

<div class="post-metadata">

**Author:** ![mohammed\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/bcef8e/32.png) [@mohammed\_a](https://www.ruby-forum.com/u/mohammed_a)\
**Post date:** [May 4, 2010, 11:34pm UTC](https://www.ruby-forum.com/t/check-if-the-there-is-no-records-found/188050/2 "2010-05-04T23:34:38Z")

</div>

On 4 May 2010 22:16, Mohammed A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> \<% if !$properties.blank? %\>

You might want to change the dollar sign to an @  
\<% if !@properties.blank? %\>

---

<div class="post-metadata">

**Author:** ![mohammed\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/bcef8e/32.png) [@mohammed\_a](https://www.ruby-forum.com/u/mohammed_a)\
**Post date:** [May 5, 2010, 5:13pm UTC](https://www.ruby-forum.com/t/check-if-the-there-is-no-records-found/188050/3 "2010-05-05T17:13:30Z")

</div>

Hey Mohammed,

You’ve used a $ sigil instead of @

Also, to maybe help it read better, don’t use the ! (not) and then you  
can  
change the contents of the if, else parts.

As a developer, that reads better. More intuitive. Just my opinion.

\<% if @properties.blank? %\>

### no records found
\<%else%\> \<%= render :partial =\> "show\_properties\_list" %\> \<%end%\>

---

<div class="post-metadata">

**Author:** ![mohammed\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/bcef8e/32.png) [@mohammed\_a](https://www.ruby-forum.com/u/mohammed_a)\
**Post date:** [May 5, 2010, 6:06pm UTC](https://www.ruby-forum.com/t/check-if-the-there-is-no-records-found/188050/4 "2010-05-05T18:06:47Z")

</div>

personally, I find  
@properties.present?  
to be more readable than  
!@properties.blank?
