This file contains hidden or 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
| class Team | |
| include Mongoid::Document | |
| has_and_belongs_to_many :captains, class_name: 'User', inverse_of: :team_captained, autosave: true | |
| has_and_belongs_to_many :members, class_name: 'User', inverse_of: :team_joined, autosave: true | |
| references_one :owner, class_name: "User", autosave: true |
This file contains hidden or 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 |
NewerOlder