Change it to || (or). Try this in IRB:
puts "Render" unless(true && false) # Prints Render puts "Render" unless(true || false) # Does not print puts "Render" unless(false || true) # Does not print puts "Render" unless(true || true) # Does not print puts "Render" unless(false || false) # Prints render (which is what you want) On Oct 1, 10:00 am, Yiannis <[email protected]> wrote: > Hello > > I have a strange problem with this code: > > <%unless (@students.empty? and params[:commit].nil?) %> > <%="test"%> > <%= render :partial => 'results' %> > <% end %> > > Even though in some cases @students.empty? returns false and params > [:commit].nil? returns true (or the opposite), it displays the test > and the render area. > > I put before and after the code the <%=params[:commit].nil?%> and < > %[email protected]?%> so I can see it (it shows false and true or the > opposite and always it shows the render area and the test). I also > tried && but it was the same problem. > > The only way it worked was this: > > <% unless @students.empty? %> > <% unless params[:commit].nil?%> > > <%="test"%> > <%= render :partial => 'results' %> > > <% end %> > <% end %> > > So why "and" - "&&" doesn't work? I tried every combination with () or > without ()... > > Thank you --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

