Sha256: 32751b10cd182d07c1f2cce721268895f5139607243154b58d16ab1b8e6a532b

Contents?: true

Size: 322 Bytes

Versions: 8

Compression:

Stored size: 322 Bytes

Contents

# frozen_string_literal: true

class Implant
  include Mongoid::Document

  field :name
  field :impressions, type: Integer, default: 0

  embedded_in :player, inverse_of: :implants

  after_build do |doc|
    doc.name = "Cochlear Implant (#{player.frags})"
  end

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mongoid-7.5.4 spec/support/models/implant.rb
mongoid-7.5.3 spec/support/models/implant.rb
mongoid-7.5.2 spec/support/models/implant.rb
mongoid-7.5.1 spec/support/models/implant.rb
mongoid-7.4.3 spec/support/models/implant.rb
mongoid-7.5.0 spec/support/models/implant.rb
mongoid-7.4.1 spec/support/models/implant.rb
mongoid-7.4.0 spec/support/models/implant.rb