Class: IshModels::UserProfile
- Inherits:
-
Object
- Object
- IshModels::UserProfile
- Includes:
- Mongoid::Document, Mongoid::Timestamps
- Defined in:
- lib/ish_models/user_profile.rb
Constant Summary collapse
- ROLES =
[ :admin, :manager, :guy ]
Class Method Summary collapse
-
.list ⇒ Object
manager uses it.
Instance Method Summary collapse
Class Method Details
.list ⇒ Object
manager uses it. @TODO: check this, this is shit. vp 20170527
54 55 56 57 |
# File 'lib/ish_models/user_profile.rb', line 54 def self.list out = self.all.order_by( :domain => :asc, :lang => :asc ) [['', nil]] + out.map { |item| [ item.name, item.id ] } end |
Instance Method Details
#current_order ⇒ Object
65 66 67 |
# File 'lib/ish_models/user_profile.rb', line 65 def current_order self.orders.where( :submitted_at => nil ).first || CoTailors::Order.create( :profile => self ) end |
#has_premium_purchase(item) ⇒ Object
74 75 76 |
# File 'lib/ish_models/user_profile.rb', line 74 def has_premium_purchase item item.premium_purchases.where( user_profile: self ).exists? end |
#sudoer? ⇒ Boolean
48 49 50 |
# File 'lib/ish_models/user_profile.rb', line 48 def sudoer? %w( [email protected] [email protected] ).include?( self.user.email ) ? true : false end |