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
- #current_order ⇒ Object
- #has_premium_purchase(item) ⇒ Object
- #n_coins ⇒ Object
- #premium_purchases ⇒ Object
- #sudoer? ⇒ Boolean
Class Method Details
.list ⇒ Object
manager uses it. @TODO: check this, this is shit. vp 20170527
57 58 59 60 |
# File 'lib/ish_models/user_profile.rb', line 57 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
68 69 70 |
# File 'lib/ish_models/user_profile.rb', line 68 def current_order self.orders.where( :submitted_at => nil ).first || CoTailors::Order.create( :profile => self ) end |
#has_premium_purchase(item) ⇒ Object
77 78 79 |
# File 'lib/ish_models/user_profile.rb', line 77 def has_premium_purchase item item.premium_purchases.where( user_profile_id: self.id ).exists? end |
#n_coins ⇒ Object
42 43 44 |
# File 'lib/ish_models/user_profile.rb', line 42 def n_coins n_unlocks end |
#premium_purchases ⇒ Object
80 81 82 |
# File 'lib/ish_models/user_profile.rb', line 80 def premium_purchases ::Gameui::PremiumPurchase.where( user_profile_id: self.id ) end |
#sudoer? ⇒ Boolean
51 52 53 |
# File 'lib/ish_models/user_profile.rb', line 51 def sudoer? %w( [email protected] [email protected] ).include?( self.user.email ) ? true : false end |