Skip to content

Instantly share code, notes, and snippets.

@seanstickle
Created May 20, 2012 21:47
Show Gist options
  • Save seanstickle/2759665 to your computer and use it in GitHub Desktop.
Save seanstickle/2759665 to your computer and use it in GitHub Desktop.
# all upcoming events for a client
def future_events_all_accounts
self.accounts.map{ |account|
account.events.in_future(account.now).where(:client_id => self.id)
}.uniq.sort_by{ |a| a.start_time }
end
# all past events for a client
def past_events_all_accounts
self.accounts.map{ |account|
account.events.in_past(account.now).where(:client_id => self.id)
}.uniq.sort_by{ |a| a.start_time }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment