Sha256: ebf731c308797f81055b08706b95e66dd8832df89f88683103f6009b7ad39bad

Contents?: true

Size: 552 Bytes

Versions: 81

Compression:

Stored size: 552 Bytes

Contents

class Game
  include Mongoid::Document

  field :high_score, type: Integer, default: 500
  field :score, type: Integer, default: 0
  field :name

  belongs_to :person, index: true, validate: true
  belongs_to :parent, class_name: "Game", foreign_key: "parent-id"
  has_one :video, validate: false
  has_many :ratings, as: :ratable, dependent: :nullify
  accepts_nested_attributes_for :person

  validates_format_of :name, without: /\$\$\$/

  set_callback(:initialize, :after) do |document|
    write_attribute("name", "Testing") unless name
  end
end

Version data entries

81 entries across 76 versions & 8 rubygems

Version Path
tdiary-5.0.8 vendor/bundle/gems/mongoid-6.4.0/spec/app/models/game.rb
mongoid-7.0.0 spec/app/models/game.rb
mongoid-6.4.0 spec/app/models/game.rb
mongoid-6.3.0 spec/app/models/game.rb
mongoid-6.2.1 spec/app/models/game.rb
mongoid-7.0.0.beta spec/app/models/game.rb
tdiary-5.0.5 vendor/bundle/gems/mongoid-6.1.0/spec/app/models/game.rb
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/vendor/bundle/gems/mongoid-6.1.0/spec/app/models/game.rb
tdiary-5.0.5 vendor/bundle/gems/mongoid-6.2.0/spec/app/models/game.rb
mongoid-6.2.0 spec/app/models/game.rb
mongoid-6.1.1 spec/app/models/game.rb
mongoid-5.2.1 spec/app/models/game.rb
tdiary-5.0.4 vendor/bundle/gems/mongoid-6.1.0/spec/app/models/game.rb
mongoid-6.1.0 spec/app/models/game.rb
mongoid-5.2.0 spec/app/models/game.rb
mongoid-5.2.0.rc0 spec/app/models/game.rb
mongoid-6.1.0.rc0 spec/app/models/game.rb
mongoid-6.0.3 spec/app/models/game.rb
mongoid-5.1.6 spec/app/models/game.rb
mongoid-6.0.2 spec/app/models/game.rb