Tuesday, May 4, 2010

[Rails] Check if the there is no records found

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%>
<h3>no records found</h3>
<%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

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment