Quoting Yiannis <[email protected]>: > > Hello > > I have a strange problem with this code: > > <%unless (@students.empty? and params[:commit].nil?) %> > <%="test"%> > <%= render :partial => 'results' %> > <% end %> >
unless both conditions are true, render the partial the equivalent is: if [email protected]? || !params[:commit].nil? I suspect you want an 'or" instead of the 'and' in the 'unless'. I.e. unless either condition is true, render the partial. unless @students.empty? or params[:commit].nil? equivalent: if [email protected]? and !params[:commit].nil? or: if [email protected]? and params[:commit] so the partial will be rendered if both there are students and params[:commit] exists and is non-nil. I personally have stopped using 'unless' with complex arguments entirely and am using it even with simple arguments less. Lookup De Morgan's Theorem (http://en.wikipedia.org/wiki/De_Morgan's_theorem) and tattoo it on your arm or commit it to memory. HTH, Jeffrey --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

