Created
June 25, 2010 02:00
-
-
Save KamaKAzii/452283 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= date_today = Date.today %><br /> | |
<% i = date_today %> | |
<% while i <= date_today + 6 %> | |
<%= i.strftime("%A") %><br /> | |
<% i = i + 1 %> | |
<% end %> |
This will do it:
def get_days_of_week
@days_of_week = Array.new
Date.today.upto(Date.today + 6) do |day|
@days_of_week << day
end
@days_of_week
end
Put that in your helper or controller and call it in the appropriate action. Then just loop through the array of dates in your view.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Oh wait I see what you're doing. That won't work.
There's a better ruby control structure that you can use. Need to find it.