Sha256: f0a3c911334bbb74aa76fd9ad7f75a3f02430894b23aa7b8a9ccd04fd5b35a7a

Contents?: true

Size: 762 Bytes

Versions: 68

Compression:

Stored size: 762 Bytes

Contents

class Player
  include Mongoid::Document
  field :active, type: Mongoid::Boolean
  field :frags, type: Integer
  field :deaths, type: Integer
  field :impressions, type: Integer, default: 0
  field :status

  scope :active, ->{ where(active: true) } do
    def extension
      "extension"
    end
  end

  scope :inactive, ->{ where(active: false) }
  scope :frags_over, ->(count) { where(:frags.gt => count) }
  scope :deaths_under, ->(count) { where(:deaths.lt => count) }
  scope :deaths_over, ->(count) { where(:deaths.gt => count) }

  has_many :weapons
  has_one :powerup

  embeds_many :implants
  embeds_one :augmentation

  after_find do |doc|
    doc.impressions += 1
  end

  class << self
    def alive
      where(status: "Alive")
    end
  end
end

Version data entries

68 entries across 63 versions & 3 rubygems

Version Path
mongoid-7.0.13 spec/app/models/player.rb
mongoid-7.0.12 spec/app/models/player.rb
mongoid-6.4.8 spec/app/models/player.rb
mongoid-7.0.11 spec/app/models/player.rb
mongoid-7.0.10 spec/app/models/player.rb
mongoid-6.4.7 spec/app/models/player.rb
mongoid-6.4.5 spec/app/models/player.rb
mongoid-7.0.8 spec/app/models/player.rb
mongoid-7.0.7 spec/app/models/player.rb
mongoid-7.0.6 spec/app/models/player.rb
mongoid-5.4.1 spec/app/models/player.rb
mongoid-7.0.5 spec/app/models/player.rb
mongoid-7.0.4 spec/app/models/player.rb
mongoid-6.4.4 spec/app/models/player.rb
mongoid-7.0.3 spec/app/models/player.rb
mongoid-6.4.2 spec/app/models/player.rb
mongoid-7.0.2 spec/app/models/player.rb
mongoid-7.0.1 spec/app/models/player.rb
mongoid-6.4.1 spec/app/models/player.rb
mongoid-5.4.0 spec/app/models/player.rb