Sha256: 9f1989c059968d346c62f37c456bd0db6883201ef7482fe7e4a0678a384785f4

Contents?: true

Size: 482 Bytes

Versions: 19

Compression:

Stored size: 482 Bytes

Contents

# frozen_string_literal: true

class Powerup
  include Mongoid::Document

  field :name

  belongs_to :player, inverse_of: :powerup

  after_build do
    self.name = "Quad Damage (#{player.frags})"
  end

  field :after_find_player
  field :after_initialize_player
  field :after_default_player, default: ->{ self.player&._id }

  after_find do |doc|
    doc.after_find_player = player&._id
  end

  after_initialize do |doc|
    doc.after_initialize_player = player&._id
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
mongoid-8.1.9 spec/support/models/powerup.rb
mongoid-8.0.9 spec/support/models/powerup.rb
mongoid-8.1.8 spec/support/models/powerup.rb
mongoid-8.1.7 spec/support/models/powerup.rb
mongoid-8.1.6 spec/support/models/powerup.rb
mongoid-8.0.8 spec/support/models/powerup.rb
mongoid-8.1.5 spec/support/models/powerup.rb
mongoid-8.1.4 spec/support/models/powerup.rb
mongoid-8.0.7 spec/support/models/powerup.rb
mongoid-8.1.3 spec/support/models/powerup.rb
mongoid-8.1.2 spec/support/models/powerup.rb
mongoid-8.0.6 spec/support/models/powerup.rb
mongoid-8.1.1 spec/support/models/powerup.rb
mongoid-8.0.5 spec/support/models/powerup.rb
mongoid-8.1.0 spec/support/models/powerup.rb
mongoid-8.0.4 spec/support/models/powerup.rb
mongoid-8.0.3 spec/support/models/powerup.rb
mongoid-8.0.2 spec/support/models/powerup.rb
mongoid-8.0.1 spec/support/models/powerup.rb