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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 4 May 2010 22:16, Mohammed Alenazi <vb4max-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> <% if !$properties.blank? %>You might want to change the dollar sign to an @ <% if !@properties.blank? %> -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.
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? %> <h3>no records found</h3> <%else%> <%= render :partial => "show_properties_list" %> <%end%> On 4 May 2010 23:32, Michael Pavling <pavling-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 4 May 2010 22:16, Mohammed Alenazi <vb4max-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > <% if !$properties.blank? %> > > You might want to change the dollar sign to an @ > <% if !@properties.blank? %> > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
personally, I find @properties.present? to be more readable than !@properties.blank? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.