Class: Cfp::Proposal
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Cfp::Proposal
- Defined in:
- app/models/cfp/proposal.rb
Constant Summary collapse
- RANK_SCALE =
(0..2).to_a
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.scoped_for(user) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'app/models/cfp/proposal.rb', line 15 def self.scoped_for(user) case when user.can_review? scoped else user.proposals end end |
Instance Method Details
#average_ranking ⇒ Object
28 29 30 |
# File 'app/models/cfp/proposal.rb', line 28 def average_ranking ranks.average(:value) end |
#can_be_edited_by?(user) ⇒ Boolean
24 25 26 |
# File 'app/models/cfp/proposal.rb', line 24 def can_be_edited_by?(user) (self.user == user) || (user.is_admin?) end |