Sha256: 98a9dea2136c7d53bdd56ca19f67330957081dc6686770bd269ae1bd6559ead7

Contents?: true

Size: 1.39 KB

Versions: 5

Compression:

Stored size: 1.39 KB

Contents

class IshModels::UserProfile  
  include Mongoid::Document
  include Mongoid::Timestamps
  
  field :username, :type => String
  field :name
  field :email

  field :fb_access_token
  field :fb_long_access_token

  field :about, :type => String
  field :education, :type => String
  field :objectives, :type => String
  field :current_employment, :type => String
  field :past_employment, :type => String
  
  field :pdf_resume_path, :type => String
  field :doc_resume_path, :type => String
  
  field :lang, :type => String, :default => :en

  ROLES = [ :admin, :manager, :guy ] 
  field :role_name, :type => Symbol

  belongs_to :user
  belongs_to :current_city, :class_name => 'City', :inverse_of => :current_users, :optional => true
  belongs_to :guide_city,   :class_name => 'City', :inverse_of => :guide,         :optional => true
 
  has_many :galleries
  has_many :reports, :inverse_of => :profile
  has_many :videos
  has_many :photos

  has_many :stocks, :class_name => 'Ish::StockWatch'

  #
  # preferences
  #
  field :videos_embed, :type => Boolean, :default => false


  def sudoer?
    %w( piousbox@gmail.com manager@gmail.com ).include?( self.user.email ) ? true : false
  end

  # manager uses it.
  # @TODO: check this, this is shit. _vp_ 20170527
  def self.list
    out = self.all.order_by( :domain => :asc, :lang => :asc )
    [['', nil]] + out.map { |item| [ item.username, item.id ] }
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ish_models-0.0.33.37 lib/ish_models/user_profile.rb
ish_models-0.0.33.36 lib/ish_models/user_profile.rb
ish_models-0.0.33.35 lib/ish_models/user_profile.rb
ish_models-0.0.33.34 lib/ish_models/user_profile.rb
ish_models-0.0.33.33 lib/ish_models/user_profile.rb