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
On 4 May 2010 22:16, Mohammed A. [email protected] wrote:
<% if !$properties.blank? %>
You might want to change the dollar sign to an @
<% if !@properties.blank? %>
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%>
personally, I find
@properties.present?
to be more readable than
!@properties.blank?