Skip to content

Commit

Permalink
added team request scopes
Browse files Browse the repository at this point in the history
  • Loading branch information
dcunited001 committed Aug 14, 2011
1 parent a10b3b0 commit fb8f25f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions app/models/team_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ class TeamRequest < ActiveRecord::Base
belongs_to :team

scope :for_team, lambda { |team| where(:team_id => team.id) }

scope :sent_from, lambda { |member| where(:member_requesting_id => member.id) }
scope :sent_to, lambda { |member| where(:member_requested_id => member.id) }



scope :pending, where('active = ? and accepted = ? and rejected = ?', false, false, false)
scope :active, where('active = ?', true)
scope :accepted, where('accepted = ?', true)
scope :rejected, where('rejected = ?', true)
scope :ended, where('accepted = ? and rejected = ?', false, true)

# incoming/outgoing requests (from the team's perspective')
scope :incoming, where('incoming = ?', true)
Expand Down

0 comments on commit fb8f25f

Please sign in to comment.