On Oct 1, 6:00 pm, 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 %>

[snip]
>
> The only way it worked was this:
>
> <%  unless @students.empty? %>
> <% unless params[:commit].nil?%>


I think you have some misunderstanding when it comes to boolean logic
- Your code that works is just fundamentally different to the first
snippet you showed.


unless a
  unless b
   ...
  end
end

is equivalent to if !a && !b

but

unless a && b
...
end
 is  equivalent to if !( a && b) which in turn is equivalent to !a || !
b  (see de morgan's laws)

Fred

>
>       <%="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
-~----------~----~----~----~------~----~------~--~---

Reply via email to