Created
May 20, 2012 21:45
-
-
Save heftig/2759658 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
def events_all_accounts(time) | |
self.accounts.flat_map do |account| | |
account.events.send(time, account.now).where(:client_id => self.id) | |
end.uniq.sort_by { |a| a.start_time } | |
end | |
private :events_all_accounts | |
# all upcoming events for a client | |
def future_events_all_accounts | |
events_all_accounts(:in_future) | |
end | |
# all past events for a client | |
def past_events_all_accounts | |
events_all_accounts(:in_past) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment