Created
February 9, 2011 04:13
-
-
Save hamannp/817865 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
if @messages = Message.all ## need to test for nil | |
@messages_in_last_week = messages_last_week ## move this out to a method | |
else | |
@messages_in_last_week = false | |
end | |
def messages_last_week | |
@messages_in_last_week = @messages.select { |m| m.created_at <= 7.days.ago } | |
@messages_in_last_week = false if @messages_in_last_week.empty? | |
## bugs happen if the variable gets assigned [] in one place and false in another | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment