I was able to take that code and flip it to this, just as a quick way
to make sure I got it:
<% if (1..5).include?(Date.today.wday)
flash[:notice] = 'weekday!'
flash[:notice] = 'weekend!'
And that totally worked. So I definitely know where to take this. But--
and I will say again, I'm new at this--WHY did it work?
Specifically, what's the (1..5) thing? I've not seen that before.
Date#wday gives the "weekday" number: 0=Sunday, 6=Saturday
1..5 is an inclusive Range
(1..5).include?(x) is a predicate that is true if x falls in the Range, it's like (1 <= x && 5 <= x)
I see that you put the code into your view. You probably want to keep this kind of logic in your controller (or possibly a helper).
In any case, in a view you could put:
<%= (1..5).include?(Date.today.wday) ? "weekday" : "weekend" %>
<% %> bracket Ruby code
<%= %> do too, but the value of the contained expression as a string is output to the page.