Module: Cfp::User
- Defined in:
- lib/cfp/user.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
3 4 5 6 7 8 |
# File 'lib/cfp/user.rb', line 3 def self.included(base) base.send(:before_validation, :setup_roles) base.send(:has_many, :proposals, :class_name => "Cfp::Proposal") base.send(:serialize, :roles) base.send(:extend, ClassMethods) end |
Instance Method Details
#can_review? ⇒ Boolean
14 15 16 |
# File 'lib/cfp/user.rb', line 14 def can_review? roles.include?(:reviewer) end |
#is_admin? ⇒ Boolean
18 19 20 |
# File 'lib/cfp/user.rb', line 18 def is_admin? roles.include?(:admin) end |
#setup_roles ⇒ Object
10 11 12 |
# File 'lib/cfp/user.rb', line 10 def setup_roles self.roles ||= [] end |